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 existing Notifications from a script
-
@thetobyde if you haven’t figured it out yet, have a look at my module https://github.com/lavolp3/MMM-NavigationBar which kind of does what you want. This one is using MMM-pages as well.
ALl that I needed for this to work out is this:
getDom: function() { var container = document.createElement("div"); container.className = "naviContainer"; self = this; for (var i = 0; i < this.config.sections.length; i++) { var buttonDiv = document.createElement("div"); buttonDiv.className = "naviButton fas fa-"+this.config.sectionIcons[this.config.sections[i]]; buttonDiv.style.fontSize = this.config.iconSize + "px"; button.addEventListener("click", function() { self.sendNotification("PAGE_CHANGED", i); }); //this.log(buttonDiv.className); container.appendChild(buttonDiv); } return container; },
-
@thetobyde I think you should avoid the node_helper and directly send a broadcast notification via
self.sendNotification()
to to the MMM-pages module.button.addEventListener("click", function() { self.sendNotification("PAGE_CHANGED", i); });
-
@lavolp3 which is what I said 3 posts back
-
@sdetweil sorry read thorugh it too fast
-
It‘s working! Thx u!!