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

dispatchAsync method #7

Merged
merged 2 commits into from
Sep 30, 2016
Merged

dispatchAsync method #7

merged 2 commits into from
Sep 30, 2016

Conversation

stamoern
Copy link
Collaborator

@stamoern stamoern self-assigned this Sep 26, 2016
* Call all listeners with specified params asynchronously
*/
dispatchAsync(...args) {
setTimeout(() => this.dispatch(...args), 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to run each listener in own setTimeout. The benefit is that if there is error on one listenres all other will be called anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Done it. Also add dispatchAsync calls accumulation, when channel is muted

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks!

- each listener called via its own setTimeout
- accumulate async calls, when channel is muted
@stamoern stamoern merged commit e8f936d into master Sep 30, 2016
@stamoern stamoern deleted the dispatch-async branch September 30, 2016 10:26
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

Successfully merging this pull request may close these issues.

2 participants