Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events not being emitted #4649

Closed
di-ov opened this issue Apr 11, 2024 · 3 comments
Closed

Events not being emitted #4649

di-ov opened this issue Apr 11, 2024 · 3 comments

Comments

@di-ov
Copy link

di-ov commented Apr 11, 2024

Current Behavior

By following the documentation and registering a handler for a given event (https://nodered.org/docs/api/ui/events/), and after double checking that the event listener is added to the list of events in node-red (I am actually able to emit it manually by myself). I see that none of the events that I have registered listeners for get emitted by the node-red runtime.

Expected Behavior

Events to be emitted and the event handlers I have registered to be triggered.

Steps To Reproduce

  • Follow the documentation and setup any of the events (e.g. deploy)
  • Trigger the flow deploy event by using the node-red UI

Example flow

paste your flow here

Environment

  • Node-RED version: 3.1.0
  • Node.js version: 18
  • npm version: 9.5.1
  • Platform/OS: Windows
  • Browser: Chrome
@knolleary
Copy link
Member

Hi @di-ov

As documented, these are editor events - they are emitted in the editor not the runtime. We do not currently have a documented set of runtime events - most uses for these events related to edit-time operations.

Is there are particular event you are interested in seeing in the runtime?

@di-ov
Copy link
Author

di-ov commented Apr 11, 2024

Hi @knolleary,

Thank you for the quick reply. I understand now, I've mistaken the editor events for runtime events.

I am interested in all types of events related to changes to the flows, I'm also interested in capturing the changes themselves after they are deploy and saved to the flows.json. And I need to have the information in the runtime (back-end).

It appears that I'll be able to come up with a solution by using the editor events, by sending the information to the runtime when an event is emitted.

Additionally, I was wondering what would be the most appropriate place in the code to register all of the handlers for the events I am interested in? Should it just go into the HTML file of one the nodes I have added?

@knolleary
Copy link
Member

Additionally, I was wondering what would be the most appropriate place in the code to register all of the handlers for the events I am interested in? Should it just go into the HTML file of one the nodes I have added?

That would do it - it is a little hacky, but works. We do have a plugin mechanism that could also be used - but if you are registering nodes, then you already have a means to run code in the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants