Read the statement by Michael Teeuw here.
notification array
-
Hello, great module, simple and precise.
Just one question (I’m not a JS expert), is there any simple way to trigger the notificaion based on an array of triggers?
eg:{
module: “MMM-NotificationTrigger”,
config: {
triggers:[
{
trigger: “DOM_OBJECTS_CREATED”,
fires: [
{
fire: [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”],
exec: “sleep 5; ls -l”
},
],
},
]
}
},Thanks
-
@MrDondoT
But is it too complex?fires:[ {fire: "NOTI_A"}, {fire: "NOTI_B"}, {fire: "NOTI_C"}, ], -
@MrDondoT
Or you can do like this tricky way;fires: [ { fire: "DUMMY", payload: (payload) => { MM.getModules().enumerate(module=>{ if (module.name == "MMM-NotificationTrigger") { module.sendNotification("NOTI_A") module.sendNotification("NOTI_B") module.sendNotification("NOTI_C") } }) return null } } ] -
Sorry Sean, my bad example! Thank you for reply but in reality I was looking for an array of triggers like so:
triggers:[
{
trigger: [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”],
fires: [
{fire: “NOTI_A”},
],
… -
@MrDondoT
You’d better make a new simple module. (Really simple)Module.register("MyTriggerModule", { notificationReceived: function (notification, payload, sender) { const myTriggers = [“MY_COMMAND”,“OTHER_COMMAND”,“ANY_COMMAND”] if (myTriggers.include(notification)) { this.sendNotification("MY_NOTIFICATION") } } })Really that’s all.
-
Thanks Sean! I appreciate your help. :thumbs_up_light_skin_tone:
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