From 1ae11745adf2502796200ba1657be7e81d100770 Mon Sep 17 00:00:00 2001 From: rushilwiz Date: Mon, 25 May 2020 02:26:44 -0400 Subject: [PATCH] Testing --- MMM-MinimalCOVID19.js | 25 ++++++++++++++++++++++--- node_helper.js | 4 +++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/MMM-MinimalCOVID19.js b/MMM-MinimalCOVID19.js index 7833590..3749a51 100644 --- a/MMM-MinimalCOVID19.js +++ b/MMM-MinimalCOVID19.js @@ -4,9 +4,28 @@ Module.register("MMM-MinimalCOVID19", { getDom: function() { var element = document.createElement("div") element.className = "myContent" - element.innerHTML = "Hello, World!" + element.innerHTML = "Hello, World! " + this.config.foo + var subElement = document.createElement("p") + subElement.id = "COUNT" + element.appendChild(subElement) return element }, - notificationReceived: function() {}, - socketNotificationReceived: function() {}, + notificationReceived: function(notification, payload, sender) { + switch (notification) { + case "DOM_OBJECTS_CREATED": + var timer = setInterval(()=>{ + this.sendSocketNotification("DO_YOUR_JOB", this.count) + this.count++ + }, 1000) + break + } + }, + socketNotificationReceived: function(notification, payload) { + switch(notification) { + case "I_DID": + var elem = document.getElementById("COUNT") + elem.innerHTML = "Count:" + payload + break + } + }, }) diff --git a/node_helper.js b/node_helper.js index dc0ca78..28dec7c 100644 --- a/node_helper.js +++ b/node_helper.js @@ -1,6 +1,8 @@ var NodeHelper = require("node_helper") module.exports = NodeHelper.create({ - start: function() {}, + start: function() { + this.countDown = 10000000 + }, socketNotificationReceived: function(notification, payload) {}, })