Read the statement by Michael Teeuw here.
Send Notification from one module to another module
-
I have one module which collects user data from somewhere. Once the data is collected how can I send notification to another module.
I can use MM.getModules().
But then How can I send notification.In Simple terms: Notify module A from module B
Thanks in advance -
@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
senderis now a object not only a string with several properties. Therefore this code snippet has changed a little bysendertosender.name:notificationReceived: function(notification, payload, sender){ if(notification === "NEW_STUFF" && sender.name === "modula"){ //handle the payload: {foo: "bar"} } }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login