I've set a JSObject-generating node to generate "on startup" instead of "on message", as it was previously generating the same XML repeatedly and loading my Raspberry Pi (when the JSObject only needs generating once from XML, and setting to a global const). However, it seems to initialise before the injector nodes, never receives the initialisation data to trigger, and fails with "ReferenceError: msg is not defined"
.
2 questions:
- Am I misunderstanding how "on startup" code works? How do I provide initialisation data for startup code?
- Is the best way to set a global constant using a change node with
global.var
tomsg.payload
?