I'd like to have something like this work:
var Events=require('events'),
test=new Events.EventEmitter,
scope={
prop:true
};
test.on('event',function() {
console.log(this.prop===true);//would log true
});
test.emit.call(scope,'event');
But, unfortunately, the listener doesn't even get called. Is there any way to do this w/ EventEmitter? I could Function.bind
to the listener, but, I'm really hoping EventEmitter
has some special (or obvious ;) way to do this...
Thanks for the help!