Is there a way to listen to editor events such as deploy only if my node is in use? I read this page but I couldn't find a function I could override when my node is dragged from the palette to the workspace (HTML File : Node-RED).
You will typically do this in your JS Module file.
module.exports = function (RED) {
function Init(config) {
RED.events.on("deploy", HandleDeploy);
}
function HandleDeploy(){
// Do something
}
RED.nodes.registerType('MyModule', Init);
}
The above will come into contact when its already in a users flow
remember to destroy the listener if your node is restarted or removed from the flow
Hi! Thank you for your reply!
Unfortunately, I can't make it work in the JS Module file... it seems that editor events (such as deploy) can only be called from the HTML file (I am not sure tho).