As it follows from the documentation, Node.js EventEmitter
calls its listeneres synchronously.
const emitter = new EventEmitter();
emitter.on('event', async (e) => {
await sendData(e);
updateUI();
});
Considering this code, one can make a reasonable guess of whenever sendData()
be overly delayed, a promise returned from the async callback may be collected, so updateUI()
will never get executed. Does this guess has any ground?
There is also currently experimental capture rejections of promises api which enables to receive notifications of promises rejections (through error
event). Does it mean in this case an EventEmitter
instance keeps all promises references in the memory, therefore collecting is impossible?