Skip to content

help plz #1

Description

@ChanYoung-dev

Module.register("MMM-Test", {
defaults: {},
start: function (){},

getDom: function() {
var element = document.createElement("div")
element.className = "myContent"
element.innerHTML = "Hello, World! " + this.config.foo
var subElement = document.createElement("p")
subElement.innerHTML = "Test"
subElement.id = "TEST"
element.appendChild(subElement)
return element
},

notificationReceived: function(notification, payload, sender) {
switch(notification) {
case "DOM_OBJECTS_CREATED":
var elem = document.getElementById("TEST")
elem.addEventListener("click", function(){
elem.innerHTML = "TEST2"
this.sendNotification('CHANGE_POSITIONS',
modules = {
'clock':{
visible: 'true',
position: 'top_left',
},
}
);
})

  break

}
},
})

It's a simple test. But it doesn't even work. What's the problem?
MMM-Test.js:23 Uncaught TypeError: this.sendNotification is not a function
at HTMLParagraphElement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions