• Home
  • Raw
  • Download

Lines Matching refs:EventEmitter

19 All objects that emit events are instances of the `EventEmitter` class. These
25 When the `EventEmitter` object emits an event, all of the functions attached
29 The following example shows a simple `EventEmitter` instance with a single
34 const EventEmitter = require('events');
36 class MyEmitter extends EventEmitter {}
50 is intentionally set to reference the `EventEmitter` instance to which the
68 the `this` keyword will no longer reference the `EventEmitter` instance:
81 The `EventEmitter` calls all listeners synchronously in the order in which
132 When an error occurs within an `EventEmitter` instance, the typical action is
136 If an `EventEmitter` does _not_ have at least one listener registered for the
164 const { EventEmitter, errorMonitor } = require('events');
166 const myEmitter = new EventEmitter();
182 const ee = new EventEmitter();
188 The `captureRejections` option in the `EventEmitter` constructor or the global
195 const ee1 = new EventEmitter({ captureRejections: true });
202 const ee2 = new EventEmitter({ captureRejections: true });
211 new instances of `EventEmitter`.
216 const ee1 = new events.EventEmitter();
228 ## Class: `EventEmitter`
239 The `EventEmitter` class is defined and exposed by the `events` module:
242 const EventEmitter = require('events');
245 All `EventEmitter`s emit the event `'newListener'` when new listeners are
262 The `EventEmitter` instance will emit its own `'newListener'` event *before*
274 class MyEmitter extends EventEmitter {}
338 const EventEmitter = require('events');
339 const myEmitter = new EventEmitter();
381 const EventEmitter = require('events');
382 const myEE = new EventEmitter();
400 Returns the current max listener value for the `EventEmitter` which is either
444 * Returns: {EventEmitter}
455 * Returns: {EventEmitter}
469 Returns a reference to the `EventEmitter`, so that calls can be chained.
476 const myEE = new EventEmitter();
492 * Returns: {EventEmitter}
503 Returns a reference to the `EventEmitter`, so that calls can be chained.
510 const myEE = new EventEmitter();
526 * Returns: {EventEmitter}
540 Returns a reference to the `EventEmitter`, so that calls can be chained.
549 * Returns: {EventEmitter}
561 Returns a reference to the `EventEmitter`, so that calls can be chained.
569 * Returns: {EventEmitter}
574 particularly when the `EventEmitter` instance was created by some other
577 Returns a reference to the `EventEmitter`, so that calls can be chained.
586 * Returns: {EventEmitter}
653 const ee = new EventEmitter();
667 Returns a reference to the `EventEmitter`, so that calls can be chained.
675 * Returns: {EventEmitter}
677 By default `EventEmitter`s will print a warning if more than `10` listeners are
680 modified for this specific `EventEmitter` instance. The value can be set to
683 Returns a reference to the `EventEmitter`, so that calls can be chained.
697 const emitter = new EventEmitter();
740 const { EventEmitter, captureRejectionSymbol } = require('events');
742 class MyClass extends EventEmitter {
764 event. This limit can be changed for individual `EventEmitter` instances
766 for *all* `EventEmitter` instances, the `events.defaultMaxListeners`
771 change affects *all* `EventEmitter` instances, including those created before
775 This is not a hard limit. The `EventEmitter` instance will allow
777 that a "possible EventEmitter memory leak" has been detected. For any single
778 `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`
818 * `emitterOrTarget` {EventEmitter|EventTarget}
824 For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
831 const { getEventListeners, EventEmitter } = require('events');
834 const ee = new EventEmitter();
858 * `emitter` {EventEmitter}
864 Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
865 event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
874 const { once, EventEmitter } = require('events');
877 const ee = new EventEmitter();
907 const { EventEmitter, once } = require('events');
909 const ee = new EventEmitter();
923 const { EventEmitter, once } = require('events');
925 const ee = new EventEmitter();
952 queue, and because `EventEmitter` emits all events synchronously, it is possible
956 const { EventEmitter, once } = require('events');
958 const myEE = new EventEmitter();
983 const { EventEmitter, once } = require('events');
985 const myEE = new EventEmitter();
1011 Change the default `captureRejections` option on all new `EventEmitter` objects.
1034 * `emitter` {EventEmitter} The emitter to query
1041 const { EventEmitter, listenerCount } = require('events');
1042 const myEmitter = new EventEmitter();
1056 * `emitter` {EventEmitter}
1063 const { on, EventEmitter } = require('events');
1066 const ee = new EventEmitter();
1085 if the `EventEmitter` emits `'error'`. It removes all listeners when
1092 const { on, EventEmitter } = require('events');
1096 const ee = new EventEmitter();
1123 * `...eventsTargets` {EventTarget[]|EventEmitter[]} Zero or more {EventTarget}
1124 or {EventEmitter} instances. If none are specified, `n` is set as the default
1125 max for all newly created {EventTarget} and {EventEmitter} objects.
1130 EventEmitter
1134 const emitter = new EventEmitter();
1175 ### `NodeEventTarget` vs. `EventEmitter`
1178 `EventEmitter` API that allows it to closely *emulate* an `EventEmitter` in
1179 certain situations. A `NodeEventTarget` is *not* an instance of `EventEmitter`
1180 and cannot be used in place of an `EventEmitter` in most cases.
1182 1. Unlike `EventEmitter`, any given `listener` can be registered at most once
1185 2. The `NodeEventTarget` does not emulate the full `EventEmitter` API.
1258 type events like `EventEmitter`.
1500 that emulates a subset of the `EventEmitter` API.
1515 equivalent `EventEmitter` API. The only difference between `addListener()` and