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

Allow event's listener to choose if events should be serial or non-serial #60

Open
AuHau opened this issue Aug 18, 2020 · 1 comment
Open

Comments

@AuHau
Copy link

AuHau commented Aug 18, 2020

Currently, there is the emit()/emitSerial() that allows the emitter (emitting side) to specify if the event's processing should be awaited or not (eq. serial processing or not). I would like to argue that most of the time the emitter does not know and understand in what context are the events processed and if serial/parallel processing should be used, instead the listener is aware of this.

I would like to propose similar functionality on the listener side with functions on() and new onSerial().

I see it that when listener is registered with onSerial(), there would be a specific queue created for this listener which upon emit() would the emitted data be pushed to this queue.

A thing I am not so sure about is how it should behave for all the combinations of emit()/emitSerial() and on()/onSerial(), but that can be though out if this proposition would get traction.

Please let me know your thoughts, happy to write PR for this.

@sindresorhus
Copy link
Owner

You have a good point. However, I would like to resolve some fundamental issues in Emittery (#51) before getting to this.

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

No branches or pull requests

2 participants