X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FPoolEmitter.html;h=7f9e3b0de6db1d6c058fe91a45196ef49404ecf1;hb=8cc4ea811611b8ad77c7b0379911afe497f2e7e4;hp=cf1e97059aa00461871ec9229c4100b6b656312e;hpb=f38f85c043864b68ea519f6bdf94821c356195f1;p=poolifier.git diff --git a/docs/classes/PoolEmitter.html b/docs/classes/PoolEmitter.html index cf1e9705..7f9e3b0d 100644 --- a/docs/classes/PoolEmitter.html +++ b/docs/classes/PoolEmitter.html @@ -1,4 +1,4 @@ -
Static
captureStatic
defaultname
property is set to 'MaxListenersExceededWarning&
Static
Readonly
error'error'
listener is installed.
'error'
listener is installed.
Symbol
s.
emitter.setMaxListeners(n)
or defaults to
Inherited from EventEmitter.getMaxListeners
.once()
).
once('ping')
lis
EventEmitter
instance. The value can be
Static
addStatic
getStatic
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
listenerStatic
onStatic
once
Listens once to the
+abort
event on the providedsignal
.Listening to the
+abort
event on abort signals is unsafe and may +lead to resource leaks since another third party with the signal can +calle.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 thatstopImmediatePropagation
does +not prevent the listener from running.Returns a disposable so that it may be unsubscribed from more easily.
+ +