X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FPoolEmitter.html;h=da05fefe3f6582519f51c4cec4d19be3ab4ebfdd;hb=437d25258782c8801daa58829575d5a51c05dcee;hp=6656707df6f2df74c43bcd47228d707e5b6c2a82;hpb=56960396878dec81e3ebeea5b76387efca8cc2dc;p=poolifier.git diff --git a/docs/classes/PoolEmitter.html b/docs/classes/PoolEmitter.html index 6656707d..da05fefe 100644 --- a/docs/classes/PoolEmitter.html +++ b/docs/classes/PoolEmitter.html @@ -1,4 +1,4 @@ -
Inherited from EventEmitter.once
Adds the listener
function to the beginning of the listeners array for the
event named eventName
. No checks are made to see if the listener
has
@@ -381,32 +381,32 @@ times.
The name of the event.
The callback function
Rest
...args: any[]Rest
...args: any[]Inherited from EventEmitter.prependListener
Adds a one-timelistener
function for the event named eventName
to the beginning of the listeners array. The next time eventName
is triggered, this
listener is removed, and then invoked.
The name of the event.
The callback function
Rest
...args: any[]Rest
...args: any[]Inherited from EventEmitter.prependOnceListener
Returns a copy of the array of listeners for the event named eventName
,
including any wrappers (such as those created by .once()
).
.once()
).
Inherited from EventEmitter.rawListeners
Removes all listeners, or those of the specified eventName
.
It is bad practice to remove listeners added elsewhere in the code, @@ -480,15 +480,15 @@ component or module (e.g. sockets or file streams).
Optional
event: string | symbolOptional
event: string | symbolInherited from EventEmitter.removeAllListeners
Removes the specified listener
from the listener array for the event namedeventName
.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
@@ -520,28 +520,28 @@ recently added instance. In the example the once('ping')
lis
Parameters
-
-
eventName: string | symbol
+eventName: string | symbol
-
-
listener: ((...args: any[]) => void)
+listener: ((...args) => void)
-
-
-- (...args: any[]): void
+
+- (...args): void
-
Parameters
-
-
Rest
...args: any[]
+Rest
...args: any[]
Inherited from EventEmitter.removeListener
By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
@@ -555,15 +555,15 @@ modified for this specific EventEmitter
instance. The value can be
Inherited from EventEmitter.setMaxListeners
Static
getReturns a copy of the array of listeners for the event named eventName
.
For EventEmitter
s this behaves exactly the same as calling .listeners
on
@@ -579,17 +579,17 @@ event target. This is useful for debugging and diagnostic purposes.
Inherited from EventEmitter.getEventListeners
Static
listenerA class method that returns the number of listeners for the given eventName
registered on the given emitter
.
const { EventEmitter, listenerCount } = require('events');
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
@@ -603,21 +603,21 @@ event target. This is useful for debugging and diagnostic purposes.
Parameters
-
-
emitter: EventEmitter
+emitter: EventEmitter
The emitter to query
-
-
eventName: string | symbol
+eventName: string | symbol
The event name
Inherited from EventEmitter.listenerCount
Static
onconst { on, EventEmitter } = require('events');
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
@@ -637,21 +637,21 @@ composed of the emitted event arguments.
The name of the event being listened for
Optional
options: StaticEventEmitterOptionsOptional
options: StaticEventEmitterOptionsInherited from EventEmitter.on
Static
onceCreates a Promise
that is fulfilled when the EventEmitter
emits the given
event or that is rejected if the EventEmitter
emits 'error'
while waiting.
@@ -676,34 +676,34 @@ special handling:
Optional
options: StaticEventEmitterOptionsOptional
options: StaticEventEmitterOptionsInherited from EventEmitter.once
Optional
options: StaticEventEmitterOptionsOptional
options: StaticEventEmitterOptionsInherited from EventEmitter.once
Static
setconst {
setMaxListeners,
EventEmitter
} = require('events');
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
@@ -714,11 +714,11 @@ special handling:
Optional
n: numberOptional
n: numberA non-negative number. The maximum number of listeners per EventTarget
event.
Rest
...eventTargets: (EventEmitter | _DOMEventTarget)[]Rest
...eventTargets: (EventEmitter | _DOMEventTarget)[]Inherited from EventEmitter.setMaxListeners
Generated using TypeDoc
Sets or gets the default captureRejection value for all emitters.