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

Listening based on regexes and wildcards #4

Open
arboleya opened this issue Apr 23, 2014 · 0 comments
Open

Listening based on regexes and wildcards #4

arboleya opened this issue Apr 23, 2014 · 0 comments

Comments

@arboleya
Copy link
Owner

It'd be great to have flexible ways to listen for events, however the emit should be individual as it is.

var test = happens();

test.on(/^he/m, function(){
  console.log('starting regex ok');
});
test.on(/lo$/m, function(){
  console.log('ending regex ok');
});
test.on(/ll/, function(){
  console.log('middle regex ok');
});

test.on('he*', function(){
  console.log('starting wildcard ok');
});
test.on('*lo', function(){
  console.log('ending wildcard ok');
});
test.on('*ll*', function(){
  console.log('middle wildcard ok');
});

test.emit('hello');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant