Expand description
Node events module: EventEmitter. The emitter is an object tagged
@@native = "EventEmitter" with a hidden @@on map (event name → the
ordered RAW listener array: a once registration is stored as node’s
_onceWrap wrapper, whose .listener is the function registered). emit collects listeners, releases the host borrow, then
invokes each so callbacks can re-enter the host.
Constants§
- METHODS
- The EventEmitter method names, exposed so
EventEmitter.prototypecan be enumerated / copied (express doesmixin(app, EventEmitter.prototype)to make itsappfunction an emitter). - STATIC_
METHODS - Static functions on the
eventsmodule namespace.EventEmitter(the self-ref ctor) andEventEmitterAsyncResourceare handled by the parent.
Functions§
- inherits_
proto_ method - Whether an emitter-backed native instance tagged
taginheritsnamefromEventEmitter.prototype— so reading it gives that very function — rather than from a class that overrides it (a Readable’son, measured:EMITTER_OVERRIDES). - instance_
call - is_
proto_ method - Whether
nameis one ofEventEmitter.prototype’s methods (measured:CLASS_PROTO_ARITY, which also makes an alias the method it is, soEventEmitter.prototype.on === EventEmitter.prototype.addListener). - new_
emitter - Construct a fresh
EventEmitter. - static_
call - Dispatch a static
events.<method>(...). ReturnsNonefor names this module does not own (e.g.EventEmitter) so the parent’s specific arm wins.