The NodeEventTarget
object implements a modified subset of the
EventEmitter
API that allows it to closely emulate an EventEmitter
in
certain situations. A NodeEventTarget
is not an instance of EventEmitter
and cannot be used in place of an EventEmitter
in most cases.
- Unlike
EventEmitter
, any givenlistener
can be registered at most once per eventtype
. Attempts to register alistener
multiple times are ignored. - The
NodeEventTarget
does not emulate the fullEventEmitter
API. Specifically theprependListener()
,prependOnceListener()
,rawListeners()
,setMaxListeners()
,getMaxListeners()
, anderrorMonitor
APIs are not emulated. The'newListener'
and'removeListener'
events will also not be emitted. - The
NodeEventTarget
does not implement any special default behavior for events with type'error'
. - The
NodeEventTarget
supportsEventListener
objects as well as functions as handlers for all event types.