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) {}, })