-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersonal_agenda.js
executable file
·62 lines (57 loc) · 1.32 KB
/
personal_agenda.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* MagicMirror²
* Module: personal_agenda
*
* By noahwo and Kalle Paananen
* MIT Licensed.
*/
Module.register("personal_agenda", {
defaults: {},
start() {
this.viewModel = {
personId: null,
agendaEvs: null
};
},
// specifies template file
getTemplate: function () {
return "personal_agenda.njk";
},
// This is called when data updated
getTemplateData: function () {
return this.viewModel;
},
// notificationReceived from other modules
notificationReceived: function (notification, payload) {
switch (notification) {
case "PERSON_RECOGNIZED":
this.sendSocketNotification("PERSONAL_AGENDA.GETCAL", {
personId: payload.personId
});
this.updateDom();
break;
case "PERSON_DISMISSED":
this.updateDom();
break;
default: {
break;
}
}
},
// socketNotificationReceived from helper
socketNotificationReceived(notificationName, payload) {
switch (notificationName) {
case "PERSONAL_AGENDA.AGENDA_RECEIVED":
if (payload) {
this.viewModel = {
personId: payload.personId,
agendaEvs: payload.agendaEvs
};
console.log(this.viewModel);
this.updateDom();
}
break;
default:
break;
}
}
});