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.
...
this.updateDom(options)
this.doSomethingWithRenderedDom()
...
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.
Or… Is there any better way to achieve this?