Is there any good practice for catching the moment updateDom() finishing? Or the moment of contents that are created by getDom() are rendered on the screen?
I have to do some job after rendering, but hard to measure or guarantee when it finishes.
The module this itself is not the only module that can call .updateDom()
.updateDom() is not promise-able or doesn’t have a callback function to notify rendering finished.
.getDom() is promise-able, but not consumable by the module itself.
in .getDom(), the contents are not rendered yet, so I cannot do certain job at that moment.
The only way I can do is using MutationObserver, but that is not convenient.
What I need might be module.domUpdated(). or await module.updateDom() or module.updateDom(options, callback). or DOM_UPDATED notification.
The commands in nodenv are implemented in scripts. While, commands from nvm are implemented in functions, which means all the 4000+ line of code have to be parsed on shell startup and increases the shell init time dramatically. nodenv initializes much faster.
Since I open sourced MagicMirror², I have received many awesome pull requests adding a lot of nice features to the Magic Mirror core. I am very grateful for that! Unfortunately, this comes with a downside: the application gets a lot more complicated.
I started an issue on GitHub to discuss the idea of simplifying the core of MagicMirror². Please let me know what you think! (Preferably in that issue).
I just want to add, that using pm2 flush in a script (for restart purposes) may not work as expected. The next operation will start immediately, before flush completes, and thus the new thread will already start writing to the file, blocking it from getting cleared.
You need to wait for the entire thread to finish, like this: