While these events (or more precisely: their handlers) are briefly mentioned in the "Creating Nodes" section of the Node-RED docs, I cannot find more detailed information about them, in particular
- when are these events emitted?
Could anybody please provide me with that information?
Thanks in advance for any help!
Those events are fired when the node is loaded into the palette (or removed).
If a node included other customisations, such as a custom sidebar or other UI elements, the onpaletteadd function is where they should get added. And onpaletteremove would be used to remove those customisations.
I think there may be an auto-generated docs site somewhere but I can't quite lay my hands on it right now.
I keep the following around as an aide-memoir:
- oneditprepare: (function) called when the edit dialog is being built.
- oneditsave: (function) called when the edit dialog is okayed.
- oneditcancel: (function) called when the edit dialog is canceled.
- oneditdelete: (function) called when the delete button in a configuration node’s edit dialog is pressed.
- oneditresize: (function) called when the edit dialog is resized.
- onpaletteadd: (function) called when the node type is added to the palette.
- onpaletteremove: (function) called when the node type is removed from the palette.
This sounds as if the event would be fired once when (after? before?) the editor is opened and once before the editor is closed (before reload? when tab is closed?)
I did not know that new node types may appear while the editor is open...
That's what happens when you use the Editor's manage palette menu. Npm packages containing node definitions are loaded in the background and entries for each defined note type are added via an API to the palette if they can be.
No - not when the editor is closed. Only when the node is removed from the palette using the Palette Manager feature.
I see - thank you very much!
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.