Hey,
I am developing my own first module. Therefore I looked at some other modules and in the dev documentation.
This is what I have right now:
Module.register("MMM-VPlan", {
defaults: {
fadeSpeed: 2,
username: "",
password: ""
},
getStyles: function() {
return ["MMM-Plan.css"];
},
start: function() {
Log.log("Starting module: " + this.name);
this.response = {
"name": "Test",
"entries": {
"lessions": "Teacher Subject Room representation"
}
};
//this.getData();
updateDom();
},
getDom: function() {
const wrapper = document.createElement("div");
wrapper.innerHTML = response;
return wrapper;
},
getData: function () {
const request = new XMLHttpRequest();
request.open('GET', 'http://localhost/vplan/' + username + '/' + password + '/today', true);
request.onreadystatechange = () => {
if (request.readyState != 4) {
return;
};
if (request.status === 200) {
this.response = JSON.parse(request.response);
this.updateDom();
} else {
Log.error(`${this.name}: Could not load data`);
}
setTimeout(() => this.getData(), this.config.updateIntervalMs);
};
request.send();
},
})
The getData() function is not in use.
My problem is the getDom() function. If I call updateDom() in the start method, the mirror shows only a black screen without any content. Even the other modules aren`t visible.
If I delete updateDom() in the start methode, the mirror shows all modules. But my module returns undefined:
