• 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.

start() vs receiving waiting for MODULE_DOM_CREATED notification?

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 74 Views 2 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.
  • D Offline
    dathbe
    last edited by Apr 11, 2025, 5:45 AM

    i was having trouble with a module reliably starting (might be my underpowered RasPi), and i thought maybe it was trying to load before the system was ready. so i moved some startup code from the start() function to a custom function that gets called after the module receives its MODULE_DOM_CREATED notification.

    is this a bad idea, just useless, or might it actually do some good?

    S 1 Reply Last reply Apr 11, 2025, 11:04 AM Reply Quote 0
    • S Away
      sdetweil @dathbe
      last edited by sdetweil Apr 12, 2025, 2:11 PM Apr 11, 2025, 11:04 AM

      @dathbe you could try waiting til ALL_MODULES_STARTED or
      DOM_OBJECTS_CREATED, per the doc
      https://docs.magicmirror.builders/development/notifications.html#system-notifications

      MODULE_DOM_CREATED is in response to getDom() returning the dom object so it might be quite late

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      D 1 Reply Last reply Apr 11, 2025, 10:06 PM Reply Quote 0
      • D Offline
        dathbe @sdetweil
        last edited by Apr 11, 2025, 10:06 PM

        @sdetweil I’d rather have late and working consistently than early and missed because of lag. I suspect most people boot their mirror at most once a day, so waiting an extra 30 seconds for the module to show content doesn’t seem like that big of a deal.

        But I’ll try DOM_OBJECTS_CREATED.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          2/3
          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