@butchkemper ok, the module development doc is here
https://docs.magicmirror.builders/module-development/introduction.html
the doc says module, but I call the JS in the browser modulename,js
cause the NAME MUST match the ‘module name’ as used in config.js module:
the note I made above comes from this comment in the modules dev doc
Note 1: When a node helper sends a notification, all modules of that module type receive the same notifications.
socketNotifications are ONLY between modulename.js and the node_helper.js in this module package. and the functions use the same name on both sides
sendSocketNotfication and socketNotificationReceived
a typical way to deal with this is for the modulename.js to provide the this.identifier value as part of every request to the node_helper (sendSocketNotification), and for the node_helper to send that value back on each response, (sendSocketNotification)
and THEN the modulename.js checks to see if the response value matches its this.identifier… (in the socketNotificationReceived function) if NOT then the response is for some other instance
these 3 steps are missing from the pihole-stats module components
if you look at my sample module while reading the doc, you can see each piece
https://github.com/sdetweil/SampleModule (it does NOT use the this.identifier)
and there is a little flow info missing
the node_helper.js in a module folder gets loaded at server side startup
then the MagicMirror index.html gets loaded in the browser
MagicMirror reads the config.js and loads each modules modulename.js into the browser as a script element, then calls the loaded/init/getScripts/getTemplates/getTranslations/start methods, and then finally the getDom or getTemplateData functions…
once the content is loaded into the browser DOM, then a notification is sent
MODULE_DOM_CREATED
that means code could query and manipulate content with dom methods
later when the modulename.js determines that NEW content should be displayed, it calls this.updateDom() and then MagicMirror will call back at getDom or getTemplate data, and after updating the internal DOM , it will signal via the MODULE_DOM_UPDATED notification
modules should be good citizens, and stop updating after suspend() and resume updating after resume()
if you open the browsr developers window, ctrl-shift-i, and select the elements tab, you can see the html structure of index.html filled out with the module info.
scripts added to the head block and content added to the body block
and if you use something like the MMM-pages module, you can watch the css effects as content is hidden and shown
and you can use the elements tab to discover and experiment with different css styles on seleted elements to help create custom.css entries…
see the second link in my signature below for a post on that info