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
Add SubscribingEventEmitter class #337
Conversation
16c75df
to
6dcc2c7
Compare
@evantahler let me know what you think of
I will definitely need help on:
|
and test cases to cover. currently, I didn't test how |
569a741
to
74a7392
Compare
@evantahler added more tests:
can you help me with typescript types? |
@evantahler added commit, as seems you don't understand how this all is glued together:
|
Extends EventEmitter to add addSubscriber method
9078f94
to
3a3572d
Compare
@evantahler you never commented this PR but now just closed? |
I thought this was coupled to #335? If it's not, can you please provide an example to show how it would be used? |
Problem: To register bulk of events, need to invoke ".on("eventname", handler) on each of the events, even handlers are coupled with the class itself, and class knows what events it wants to listen to.
Soliution: Add new class, which extends
EventEmitter
and addsaddSubscriber
method.To make this appear for example to Worker class, it's parent must be updated: