Event for node paste/import


#1

Hi
Is there an event I can listen on to be notified when a node is copy/pasted or imported? I am looking for something similar to node.on("close", function (){...

Something like node.on("paste", function (){...

I have verified that the constructor does not get called in the above scenario- so I cant use that.

Thanks
Uma


#2

Never mind- I worked around it by adding my code in the constructor


#3

Hi @uma - my apologies for missing your original post. Glad to hear you've worked around the issue.

In your original question you are mixing runtime lifecycle of a node with the editor lifecycle of a node.

The runtime doesn't know anything about what is happening in the editor until you click the deploy button and the new flow configuration is passed in.

There are techniques for the editor to send custom api calls back to the runtime to help gather configuration information - for example, the Serial nodes will list the available serial ports in the edit dialog using this method. A basic outline of how that works is available here.


#4

Thanks a bunch for this Nick- I find the capability to make calls to the runtime from the editor very convenient indeed. Kudos for having developed this feature :slight_smile: