X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FPoolEmitter.html;h=c3b293d919c3da1ccf3cc46df486617ff736a381;hb=a25c335d7e5573a171fc96c445cb6092852b2c4a;hp=5d097d487c38d2bb19370a724de5d7ca3957faea;hpb=3db479d12e6d8dff22ca35537d96af8d6830ff13;p=poolifier.git diff --git a/docs/classes/PoolEmitter.html b/docs/classes/PoolEmitter.html index 5d097d48..c3b293d9 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.
+ +