-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMMM-bunq.js
executable file
·65 lines (55 loc) · 1.41 KB
/
MMM-bunq.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
63
64
65
/* Magic Mirror
* Module: MMM-bunq
*
* By Cedrik Hoffmann
* MIT Licensed.
*/
Module.register("MMM-bunq", {
defaults: {
monetaryDescription: "",
iban: "",
apiKey: "",
updateInterval: 60000,
title: "balance",
unit: "€"
},
requiresVersion: "2.1.0", // Required version of MagicMirror
start: function () {
var self = this;
this.finalSaldo = 0;
this.sendSocketNotification("HERE_IS_YOUR_CONFIG", this.config);
setInterval(function () {
self.sendSocketNotification("UPDATE_PLEASE");
self.updateDom();
}, this.config.updateInterval);
},
getDom: function () {
// create element wrapper for show into the module
var wrapper = document.createElement("div");
wrapper.id = "saldo";
wrapper.innerText =
this.config.title + ": " + this.finalSaldo + this.config.unit;
return wrapper;
},
getScripts: function () {
return [];
},
getStyles: function () {
return ["MMM-bunq.css"];
},
// Load translations files
getTranslations: function () {
//FIXME: This can be load a one file javascript definition
return {
en: "translations/en.json",
de: "translations/de.json"
};
},
// socketNotificationReceived from helper
socketNotificationReceived: function (notification, payload) {
if (notification === "HERE_IS_FINAL_SALDO") {
this.finalSaldo = payload;
this.updateDom();
}
}
});