X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FPoolEmitter.html;h=4aef2ce0cdb85a9c665a8253eb145eb7fe5bb9ce;hb=0717df3dc168fc35b8268713ac8b7bde86f024a9;hp=59b4cdd424b334d27b3e311bbd44fd7b70c9a9d4;hpb=d33d2d2fed43d102479c38cc28b496872665a90d;p=poolifier.git diff --git a/docs/classes/PoolEmitter.html b/docs/classes/PoolEmitter.html index 59b4cdd4..4aef2ce0 100644 --- a/docs/classes/PoolEmitter.html +++ b/docs/classes/PoolEmitter.html @@ -1,4 +1,4 @@ -
Optional
options: EventEmitterOptionsStatic
capturev13.4.0, v12.16.0
Static
defaultname
property is set to 'MaxListenersExceededWarning&
Since
v0.11.2
Static
Readonly
error'error'
listener is installed.
v13.6.0, v12.17.0
'error'
listener is installed.
v0.1.26
v0.1.26
Symbol
s.
v6.0.0
emitter.setMaxListeners(n)
or defaults to
v1.0.0
v3.2.0
v0.1.26
v10.0.0
v0.1.101
v0.3.0
v6.0.0
v6.0.0
.once()
).
v9.4.0
v0.1.26
once('ping')
lis
v0.1.26
EventEmitter
instance. The value can be
v0.3.5
Static
addExperimental
+Listens once to the abort
event on the provided signal
.
Listening to the abort
event on abort signals is unsafe and may
+lead to resource leaks since another third party with the signal can
+call e.stopImmediatePropagation()
. Unfortunately Node.js cannot change
+this since it would violate the web standard. Additionally, the original
+API makes it easy to forget to remove listeners.
This API allows safely using AbortSignal
s in Node.js APIs by solving these
+two issues by listening to the event such that stopImmediatePropagation
does
+not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
+import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
+
+that removes the abort
listener.
v20.5.0
+Static
getv15.2.0, v14.17.0
Static
getReturns the currently set max amount of listeners.
+For EventEmitter
s this behaves exactly the same as calling .getMaxListeners
on
+the emitter.
For EventTarget
s this is the only way to get the max event listeners for the
+event target. If the number of event handlers on a single EventTarget exceeds
+the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
+
+v19.9.0
+Static
listenerSince v3.2.0 - Use listenerCount
instead.
Static
onv13.6.0, v12.16.0
Static
oncev11.13.0, v10.16.0
Optional
options: StaticEventEmitterOptionsStatic
setv15.4.0
Since
v13.4.0, v12.16.0