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

Trouble with Sending Notifcation on Module Start

Scheduled Pinned Locked Moved Development
5 Posts 2 Posters 194 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.
  • R Offline
    raspberrypi9
    last edited by Mar 14, 2025, 1:22 AM

    I am trying to get a feature to work that depends on the clock module broadcasting a notification upon start up. I put a call to this.sendNotification() in the start() function in clock.js, but it doesn’t appear like it is being executed. Is there something subtle about the timing of modules being loaded so that the other modules is listening when the clock sends this notification?

    Also, I know there was a post somewhere about logging. This is ten times harder than it should be because most/all of my log messages don’t seem to show up when I run: npm start dev.

    Thanks so much for your help.

    S 1 Reply Last reply Mar 14, 2025, 1:46 AM Reply Quote 0
    • S Away
      sdetweil @raspberrypi9
      last edited by sdetweil Mar 14, 2025, 1:48 AM Mar 14, 2025, 1:46 AM

      @raspberrypi9 all the modules aren’t ready yet

      That is what the ALL_MODULES_STARTED and
      DOM_OBJECTS_CREATED notifications are for

      And all the modules start() functions are called one module at a time, so UNLESS the module you WANT to talk to is BEFORE YOUR module in config.js. It’s not even loaded yet

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S 1 Reply Last reply Mar 14, 2025, 2:54 AM Reply Quote 0
      • S Away
        sdetweil @sdetweil
        last edited by sdetweil Mar 14, 2025, 4:40 AM Mar 14, 2025, 2:54 AM

        @raspberrypi9

        So, net, don’t send to other modules til after ALL_MODULES_STARTED

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • R Offline
          raspberrypi9
          last edited by Mar 14, 2025, 3:33 AM

          Thank you!

          S 1 Reply Last reply Mar 14, 2025, 4:47 AM Reply Quote 0
          • S Away
            sdetweil @raspberrypi9
            last edited by sdetweil Mar 14, 2025, 4:48 AM Mar 14, 2025, 4:47 AM

            @raspberrypi9 my pleasure,
            And actually DOM_OBJECTS_CREATED means YOUR module’s content has been placed in the DOM the first time
            And DOM_OBJECTS_UPDATED is each time after that
            Because updateDom() is asynchronous now

            If you ever tried to document.getElementByID after getDom(),
            but it returned null. Then you needed to wait for one of those notifications

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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