mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #1141 from ConnorChristie/old-dom-event-fix
Fix to emit DOM_OBJECTS_CREATED event after module DOMs have actually loaded
This commit is contained in:
commit
22d32d7ca3
10
js/main.js
10
js/main.js
@ -19,6 +19,8 @@ var MM = (function() {
|
||||
* are configured for a specific position.
|
||||
*/
|
||||
var createDomObjects = function() {
|
||||
var domCreationPromises = [];
|
||||
|
||||
modules.forEach(module => {
|
||||
if (typeof module.data.position !== "string") {
|
||||
return;
|
||||
@ -48,14 +50,18 @@ var MM = (function() {
|
||||
moduleContent.className = "module-content";
|
||||
dom.appendChild(moduleContent);
|
||||
|
||||
updateDom(module, 0).then(() => {
|
||||
var domCreationPromise = updateDom(module, 0);
|
||||
domCreationPromises.push(domCreationPromise);
|
||||
domCreationPromise.then(() => {
|
||||
sendNotification("MODULE_DOM_CREATED", null, null, module);
|
||||
}).catch(Log.error);
|
||||
});
|
||||
|
||||
updateWrapperStates();
|
||||
|
||||
sendNotification("DOM_OBJECTS_CREATED");
|
||||
Promise.all(domCreationPromises).then(() => {
|
||||
sendNotification("DOM_OBJECTS_CREATED");
|
||||
});
|
||||
};
|
||||
|
||||
/* selectWrapper(position)
|
||||
|
Loading…
x
Reference in New Issue
Block a user