API
EventEmitter.prototype.on(type, fn)
type
string - message typefn
function - handler to add
Add a handler for a message type
EventEmitterprototype { var wrapped; ctx = ctx || this; { fn; }; fnwrapped = wrapped; if!thislistenerstype thislistenerstype = wrapped; else thislistenerstype; };
EventEmitter.prototype.once(type, fn)
type
string - message typefn
function - handler to add
Add a handler for a message type which removes itself after a single execution
EventEmitterprototype { var wrapped; ctx = ctx || this; { ctx; fn; }; fnwrapped = wrapped; if!thislistenerstype thislistenerstype = wrapped; else thislistenerstype; };
EventEmitter.prototype.off(type, fn)
type
string - message typefn
function - handler to remove
Remove a handler for a message type
EventEmitterprototype { var index index2; ifthislistenerstype index = thislistenerstype; index2 = thislistenerstype; ifindex > -1 thislistenerstype; return true; else ifindex2 > -1 thislistenerstype; return true; else return false; else return false; };
EventEmitter.prototype.emit(type, payload)
type
string - the type of event to emitpayload
...(object,number,string) - Any additional arguments will be sent to the handlers for this event
Triggers an event of a specific type, with any additional payload passed.
EventEmitterprototype { var payload = Arrayprototypeslice fns = thislistenerstype || i; fori=0; i<fnslength; i++ fnsipayload; }; moduleexports = EventEmitter;}{}}{}1)