Activate a node when closing

Hello,

I am new to Node-red and i am looking for a node that can be launched when the main window is closing so that i can clean up some project contents. I searched for something like this but did not find anything.

what do you mean with main window?

I mean the window containing all node, along with each flows and options and ... . The window we usually close with the cross in the top rigth-hhand corner. In my project we have a dedicated soft that contains one tab for Node-red flow creation and another tab that shows the result. But when i do some experiment and then close this soft, i would like to be able to automatically do something.

There are no events triggered in the runtime when an editor window is opened or closed - so no, what you want doesn't exist.

what about this: https://nodered.org/docs/user-guide/writing-functions#tidying-up ? i am not sure when it should trigger ?

that is triggered when the flow shuts down - on the runtime side - not the editor side.