And you’re using the MMM-Calendarweek module? Does my notificationReceived look like it should be working to you?
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
S
Posts
-
RE: CALENDAR_EVENTS not broadcasting? MMM-Calendarweek
-
CALENDAR_EVENTS not broadcasting? MMM-Calendarweek
Hey so I’m trying to make an app do something if it receives the notification ‘CALENDAR_EVENTS’ from the calendar.
So far its not doing anything. I tried to use the alert module but I get nothing from that either. If MMM-CalendarWeek isnt properly working with broadcasts, is there a way to set up the stock calendar module to work in the background?
My code is here
// Default module config. defaults: { this.hide(), text: "Calendar alert receieved!" }, notificationReceived: function(notification, payload, sender) { if (notification === 'CALENDAR_EVENTS') { var x = payload, for (let value of x) { this.show(), var startTime = new Date(startDate), var endTime = new Date(endDate), var ms = (endTime.getTime() - startTime.getTime()) / 1000, setTimeout(function(){ this.hide() }, ms), } } }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); wrapper.innerHTML = this.config.text; return wrapper; } });