• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Catching the DOM content is updated

Scheduled Pinned Locked Moved Unsolved Feature Requests
1 Posts 1 Posters 194 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    MMRIZE
    last edited by MMRIZE Nov 20, 2023, 4:27 PM Nov 20, 2023, 3:21 PM

    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()
    ...
    
    1. The module this itself is not the only module that can call .updateDom()
    2. .updateDom() is not promise-able or doesn’t have a callback function to notify rendering finished.
    3. .getDom() is promise-able, but not consumable by the module itself.
    4. in .getDom(), the contents are not rendered yet, so I cannot do certain job at that moment.
    5. 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?

    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post
    Enjoying MagicMirror? Please consider a donation!
    MagicMirror created by Michael Teeuw.
    Forum managed by Sam, technical setup by Karsten.
    This forum is using NodeBB as its core | Contributors
    Contact | Privacy Policy