Hi
I am trying to define a custom global function in ui_base.js and access it within a Function node in Node-RED. However, I am encountering an undefined error when attempting to use the function.
module.exports = function (RED) {
// Register the global function when the nodes have started
RED.events.on('nodes-started', () => {
const globalContext = RED.runtime.context.global;
globalContext.set('myUtilityFunction', (param) => {
return `Processed: ${param}`;
});
});
// Custom node definition here, if needed
};
Could someone help me identify what might be causing the undefined
error or how to correctly set up and access the global function in Node-RED?
Thanks in advance!