A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Send Notification from one module to another module
-
@edubey
modulathis.sendNotification("NEW_STUFF", {foo: "bar"});
modulb
notificationReceived: function(notification, payload, sender){ if(notification === "NEW_STUFF" && sender === "modula"){ //handle the payload: {foo: "bar"} } }
-
@strawberry-3.141
Thanks, i got it -
Okay, so its more of a broadcast to all modules, not to any specific…right?
-
@edubey said in Send Notification from one module to another module:
Okay, so its more of a broadcast to all modules, not to any specific…right?
That’s right. This command sends out a broadcast to all modules. As long as you use a broadcast notification no other module reacts on you don’t have any trouble.
-
It seemed the
sender
is now a object not only a string with several properties. Therefore this code snippet has changed a little bysender
tosender.name
:notificationReceived: function(notification, payload, sender){ if(notification === "NEW_STUFF" && sender.name === "modula"){ //handle the payload: {foo: "bar"} } }