You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This might not be a bug I could just be misunderstanding.
When I run the bellow code it just exits at the end of the script. I thought though if there where events registered that the program would not just exit but continue to run.
Got you. So holding on to resources outside of Node keeps the wheel turning. I was confused from the laymen's point of view it seemed to be being explained in the way that the event que listening to something registered to on would keep the script alive.
Thank you. I don`t completely understand why it works this way but at least I know how now I can dig into it more.
that the event que listening to something registered to on would keep the script alive.
Think of it like this: an EventEmitter in itself isn't useful, it only becomes useful when it's tied to something that emits interesting events (data from the network or the file system, a timer that expires, etc.).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This might not be a bug I could just be misunderstanding.
When I run the bellow code it just exits at the end of the script. I thought though if there where events registered that the program would not just exit but continue to run.
var events = require('events');
var eventEmitter = new events.EventEmitter();
eventEmitter.on('someOccurence', function(message){
console.log(message);
});
The text was updated successfully, but these errors were encountered: