Skip to content

Listening based on regexes and wildcards #4

Open
@arboleya

Description

@arboleya

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');

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions