hij1nx/EventEmitter2 — Issue #44: Implement 'before' and 'after' emitter aspects?
Author: Marak
Created: 2012-01-05 00:07:13+00:00
State: open

Would it make sense to add `emitter.before` and `emitter.after` so that we can bind methods to these aspects of events?

The API would look like:

``` js
emitter.on('sup::dog', function(){
console.log('hello');
});

emitter.before('sup::dog', function(args){
// indicates that 'sup::dog' event will not fire
return false;
});

emitter.on('sup::cat', function(){
console.log('hello');
// indicates after event will not fire if bound
return false;
});

emitter.after('sup::cat', function(){
console.log('hello');
});
```