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

Promise support #6

Open
eddieajau opened this issue Nov 14, 2017 · 1 comment
Open

Promise support #6

eddieajau opened this issue Nov 14, 2017 · 1 comment

Comments

@eddieajau
Copy link

I don't support you'd be interested in working on a version that supports returning a Promise (I'm happy to help if you are)? For example:

events.on('test', function (e) {
  // The next event listener will wait til this is done
  return new Promise((resolve) => {
    setTimeout(resolve, 1000);
  });
});

// Then either
events.emit('test', { data: 'data' })
  .catch(err => console.log('Oops:', err));

// Or
try {
  await events.emit('test', { data: 'data' });
}
catch (err) {
  console.log('Oops:', err)
}

Thanks in advance.

@ahultgren
Copy link
Owner

I think this makes sense. I don't have much time to work on OS projects nowadays though, so can't make any guarantees about when. Help is welcome.

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

3 participants
@eddieajau @ahultgren and others