1 <!DOCTYPE html
><html class=
"default" lang=
"en"><head><meta charSet=
"utf-8"/><meta http-equiv=
"x-ua-compatible" content=
"IE=edge"/><title>PoolEmitter | poolifier
</title><meta name=
"description" content=
"Documentation for poolifier"/><meta name=
"viewport" content=
"width=device-width, initial-scale=1"/><link rel=
"stylesheet" href=
"../assets/style.css"/><link rel=
"stylesheet" href=
"../assets/highlight.css"/><script defer
src=
"../assets/main.js"></script><script async
src=
"../assets/search.js" id=
"tsd-search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem(
"tsd-theme") ||
"os"</script><header class=
"tsd-page-toolbar">
2 <div class=
"tsd-toolbar-contents container">
3 <div class=
"table-cell" id=
"tsd-search" data-base=
"..">
4 <div class=
"field"><label for=
"tsd-search-field" class=
"tsd-widget tsd-toolbar-icon search no-caption"><svg width=
"16" height=
"16" viewBox=
"0 0 16 16" fill=
"none"><path d=
"M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill=
"var(--color-text)"></path></svg></label><input type=
"text" id=
"tsd-search-field" aria-label=
"Search"/></div>
6 <div id=
"tsd-toolbar-links"></div></div>
8 <li class=
"state loading">Preparing search index...
</li>
9 <li class=
"state failure">The search index is not available
</li></ul><a href=
"../index.html" class=
"title">poolifier
</a></div>
10 <div class=
"table-cell" id=
"tsd-widgets"><a href=
"#" class=
"tsd-widget tsd-toolbar-icon menu no-caption" data-toggle=
"menu" aria-label=
"Menu"><svg width=
"16" height=
"16" viewBox=
"0 0 16 16" fill=
"none"><rect x=
"1" y=
"3" width=
"14" height=
"2" fill=
"var(--color-text)"></rect><rect x=
"1" y=
"7" width=
"14" height=
"2" fill=
"var(--color-text)"></rect><rect x=
"1" y=
"11" width=
"14" height=
"2" fill=
"var(--color-text)"></rect></svg></a></div></div></header>
11 <div class=
"container container-main">
12 <div class=
"col-content">
13 <div class=
"tsd-page-title">
14 <ul class=
"tsd-breadcrumb">
15 <li><a href=
"../index.html">poolifier
</a></li>
16 <li><a href=
"PoolEmitter.html">PoolEmitter
</a></li></ul>
17 <h1>Class PoolEmitter
</h1></div>
18 <section class=
"tsd-panel tsd-comment">
19 <div class=
"tsd-comment tsd-typography"><p>Pool events emitter.
</p>
21 <section class=
"tsd-panel tsd-hierarchy">
23 <ul class=
"tsd-hierarchy">
24 <li><span class=
"tsd-signature-type ">EventEmitter
</span>
25 <ul class=
"tsd-hierarchy">
26 <li><span class=
"target">PoolEmitter
</span></li></ul></li></ul></section><aside class=
"tsd-sources">
28 <li>Defined in
<a href=
"https://github.com/poolifier/poolifier/blob/3db6a2b/src/pools/pool.ts#L35">src/pools/pool.ts:
35</a></li></ul></aside>
29 <section class=
"tsd-panel-group tsd-index-group">
30 <section class=
"tsd-panel tsd-index-panel">
31 <details class=
"tsd-index-content tsd-index-accordion" open
><summary class=
"tsd-accordion-summary tsd-index-summary">
32 <h5 class=
"tsd-index-heading uppercase" role=
"button" aria-expanded=
"false" tabIndex=
0><svg width=
"16" height=
"16" viewBox=
"0 0 16 16" fill=
"none"><path d=
"M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill=
"var(--color-text)"></path></svg> Index
</h5></summary>
33 <div class=
"tsd-accordion-details">
34 <section class=
"tsd-index-section">
35 <h3 class=
"tsd-index-heading">Constructors
</h3>
36 <div class=
"tsd-index-list"><a href=
"PoolEmitter.html#constructor" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"#4D7FFF" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"12" id=
"icon-512-path"></rect><path d=
"M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill=
"var(--color-text)" id=
"icon-512-text"></path></svg><span>constructor
</span></a>
38 <section class=
"tsd-index-section">
39 <h3 class=
"tsd-index-heading">Properties
</h3>
40 <div class=
"tsd-index-list"><a href=
"PoolEmitter.html#captureRejectionSymbol" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"#FF984D" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"12" id=
"icon-1024-path"></rect><path d=
"M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill=
"var(--color-text)" id=
"icon-1024-text"></path></svg><span>capture
<wbr/>Rejection
<wbr/>Symbol
</span></a>
41 <a href=
"PoolEmitter.html#captureRejections" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>capture
<wbr/>Rejections
</span></a>
42 <a href=
"PoolEmitter.html#defaultMaxListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>default
<wbr/>Max
<wbr/>Listeners
</span></a>
43 <a href=
"PoolEmitter.html#errorMonitor" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>error
<wbr/>Monitor
</span></a>
45 <section class=
"tsd-index-section">
46 <h3 class=
"tsd-index-heading">Methods
</h3>
47 <div class=
"tsd-index-list"><a href=
"PoolEmitter.html#addListener" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"#FF4DB8" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"12" id=
"icon-2048-path"></rect><path d=
"M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill=
"var(--color-text)" id=
"icon-2048-text"></path></svg><span>add
<wbr/>Listener
</span></a>
48 <a href=
"PoolEmitter.html#emit" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>emit
</span></a>
49 <a href=
"PoolEmitter.html#eventNames" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>event
<wbr/>Names
</span></a>
50 <a href=
"PoolEmitter.html#getMaxListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>get
<wbr/>Max
<wbr/>Listeners
</span></a>
51 <a href=
"PoolEmitter.html#listenerCount" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listener
<wbr/>Count
</span></a>
52 <a href=
"PoolEmitter.html#listeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listeners
</span></a>
53 <a href=
"PoolEmitter.html#off" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>off
</span></a>
54 <a href=
"PoolEmitter.html#on" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>on
</span></a>
55 <a href=
"PoolEmitter.html#once" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>once
</span></a>
56 <a href=
"PoolEmitter.html#prependListener" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>prepend
<wbr/>Listener
</span></a>
57 <a href=
"PoolEmitter.html#prependOnceListener" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>prepend
<wbr/>Once
<wbr/>Listener
</span></a>
58 <a href=
"PoolEmitter.html#rawListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>raw
<wbr/>Listeners
</span></a>
59 <a href=
"PoolEmitter.html#removeAllListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>remove
<wbr/>All
<wbr/>Listeners
</span></a>
60 <a href=
"PoolEmitter.html#removeListener" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>remove
<wbr/>Listener
</span></a>
61 <a href=
"PoolEmitter.html#setMaxListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>set
<wbr/>Max
<wbr/>Listeners
</span></a>
62 <a href=
"PoolEmitter.html#getEventListeners" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>get
<wbr/>Event
<wbr/>Listeners
</span></a>
63 <a href=
"PoolEmitter.html#listenerCount-2" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listener
<wbr/>Count
</span></a>
64 <a href=
"PoolEmitter.html#on-2" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>on
</span></a>
65 <a href=
"PoolEmitter.html#once-2" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>once
</span></a>
66 <a href=
"PoolEmitter.html#setMaxListeners-2" class=
"tsd-index-link tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>set
<wbr/>Max
<wbr/>Listeners
</span></a>
67 </div></section></div></details></section></section>
68 <section class=
"tsd-panel-group tsd-member-group">
70 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"constructor" class=
"tsd-anchor"></a>
71 <h3 class=
"tsd-anchor-link"><span>constructor
</span><a href=
"#constructor" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><path stroke=
"none" d=
"M0 0h24v24H0z" fill=
"none" id=
"icon-anchor-a"></path><path d=
"M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id=
"icon-anchor-b"></path><path d=
"M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id=
"icon-anchor-c"></path></svg></a></h3>
72 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
73 <li class=
"tsd-signature tsd-anchor-link" id=
"constructor.new_PoolEmitter"><span class=
"tsd-kind-constructor-signature">new
<wbr/>Pool
<wbr/>Emitter
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">options
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#constructor.new_PoolEmitter" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
74 <li class=
"tsd-description">
75 <div class=
"tsd-parameters">
76 <h4 class=
"tsd-parameters-title">Parameters
</h4>
77 <ul class=
"tsd-parameter-list">
79 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">options
</span>:
<span class=
"tsd-signature-type ">EventEmitterOptions
</span></h5></li></ul></div>
80 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
81 <p>Inherited from EventEmitter.constructor
</p>
83 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
111</li></ul></aside></li></ul></section></section>
84 <section class=
"tsd-panel-group tsd-member-group">
86 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"captureRejectionSymbol" class=
"tsd-anchor"></a>
87 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <code class=
"tsd-tag ts-flagReadonly">Readonly
</code> <span>capture
<wbr/>Rejection
<wbr/>Symbol
</span><a href=
"#captureRejectionSymbol" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
88 <div class=
"tsd-signature"><span class=
"tsd-kind-property">capture
<wbr/>Rejection
<wbr/>Symbol
</span><span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-symbol">typeof
</span><a href=
"PoolEmitter.html#captureRejectionSymbol" class=
"tsd-signature-type tsd-kind-property">captureRejectionSymbol
</a></div><aside class=
"tsd-sources">
89 <p>Inherited from EventEmitter.captureRejectionSymbol
</p>
91 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
328</li></ul></aside></section>
92 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"captureRejections" class=
"tsd-anchor"></a>
93 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>capture
<wbr/>Rejections
</span><a href=
"#captureRejections" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
94 <div class=
"tsd-signature"><span class=
"tsd-kind-property">capture
<wbr/>Rejections
</span><span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">boolean
</span></div>
95 <div class=
"tsd-comment tsd-typography"><p>Sets or gets the default captureRejection value for all emitters.
</p>
96 </div><aside class=
"tsd-sources">
97 <p>Inherited from EventEmitter.captureRejections
</p>
99 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
333</li></ul></aside></section>
100 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"defaultMaxListeners" class=
"tsd-anchor"></a>
101 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>default
<wbr/>Max
<wbr/>Listeners
</span><a href=
"#defaultMaxListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
102 <div class=
"tsd-signature"><span class=
"tsd-kind-property">default
<wbr/>Max
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">number
</span></div><aside class=
"tsd-sources">
103 <p>Inherited from EventEmitter.defaultMaxListeners
</p>
105 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
334</li></ul></aside></section>
106 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"errorMonitor" class=
"tsd-anchor"></a>
107 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <code class=
"tsd-tag ts-flagReadonly">Readonly
</code> <span>error
<wbr/>Monitor
</span><a href=
"#errorMonitor" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
108 <div class=
"tsd-signature"><span class=
"tsd-kind-property">error
<wbr/>Monitor
</span><span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-symbol">typeof
</span><a href=
"PoolEmitter.html#errorMonitor" class=
"tsd-signature-type tsd-kind-property">errorMonitor
</a></div>
109 <div class=
"tsd-comment tsd-typography"><p>This symbol shall be used to install a listener for only monitoring
<code>'error
'</code>
110 events. Listeners installed using this symbol are called before the regular
111 <code>'error
'</code> listeners are called.
</p>
112 <p>Installing a listener using this symbol does not change the behavior once an
113 <code>'error
'</code> event is emitted, therefore the process will still crash if no
114 regular
<code>'error
'</code> listener is installed.
</p>
115 </div><aside class=
"tsd-sources">
116 <p>Inherited from EventEmitter.errorMonitor
</p>
118 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
327</li></ul></aside></section></section>
119 <section class=
"tsd-panel-group tsd-member-group">
121 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"addListener" class=
"tsd-anchor"></a>
122 <h3 class=
"tsd-anchor-link"><span>add
<wbr/>Listener
</span><a href=
"#addListener" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
123 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
124 <li class=
"tsd-signature tsd-anchor-link" id=
"addListener.addListener-1"><span class=
"tsd-kind-call-signature">add
<wbr/>Listener
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#addListener.addListener-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
125 <li class=
"tsd-description">
126 <div class=
"tsd-comment tsd-typography"><p>Alias for
<code>emitter.on(eventName, listener)
</code>.
</p>
128 <h3>Since
</h3><p>v0.1
.26</p>
130 <div class=
"tsd-parameters">
131 <h4 class=
"tsd-parameters-title">Parameters
</h4>
132 <ul class=
"tsd-parameter-list">
134 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li>
136 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
137 <ul class=
"tsd-parameters">
138 <li class=
"tsd-parameter-signature">
139 <ul class=
"tsd-signatures tsd-is-external">
140 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
141 <li class=
"tsd-description">
142 <div class=
"tsd-parameters">
143 <h4 class=
"tsd-parameters-title">Parameters
</h4>
144 <ul class=
"tsd-parameter-list">
146 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
147 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
148 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
149 <p>Inherited from EventEmitter.addListener
</p>
151 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
354</li></ul></aside></li></ul></section>
152 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"emit" class=
"tsd-anchor"></a>
153 <h3 class=
"tsd-anchor-link"><span>emit
</span><a href=
"#emit" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
154 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
155 <li class=
"tsd-signature tsd-anchor-link" id=
"emit.emit-1"><span class=
"tsd-kind-call-signature">emit
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">boolean
</span><a href=
"#emit.emit-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
156 <li class=
"tsd-description">
157 <div class=
"tsd-comment tsd-typography"><p>Synchronously calls each of the listeners registered for the event named
<code>eventName
</code>, in the order they were registered, passing the supplied arguments
159 <p>Returns
<code>true
</code> if the event had listeners,
<code>false
</code> otherwise.
</p>
160 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEmitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-7">// First listener
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">firstListener
</span><span class=
"hl-0">() {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Helloooo! first listener
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span><br/><span class=
"hl-7">// Second listener
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">secondListener
</span><span class=
"hl-0">(
</span><span class=
"hl-3">arg1
</span><span class=
"hl-0">,
</span><span class=
"hl-3">arg2
</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">`event with parameters
</span><span class=
"hl-4">${
</span><span class=
"hl-3">arg1
</span><span class=
"hl-4">}
</span><span class=
"hl-6">,
</span><span class=
"hl-4">${
</span><span class=
"hl-3">arg2
</span><span class=
"hl-4">}
</span><span class=
"hl-6"> in second listener`
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span><br/><span class=
"hl-7">// Third listener
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">thirdListener
</span><span class=
"hl-0">(...
</span><span class=
"hl-3">args
</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">parameters
</span><span class=
"hl-0"> =
</span><span class=
"hl-3">args
</span><span class=
"hl-0">.
</span><span class=
"hl-2">join
</span><span class=
"hl-0">(
</span><span class=
"hl-6">',
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">`event with parameters
</span><span class=
"hl-4">${
</span><span class=
"hl-3">parameters
</span><span class=
"hl-4">}
</span><span class=
"hl-6"> in third listener`
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span><br/><br/><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">listeners
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">));
</span><br/><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-1">1</span><span class=
"hl-0">,
</span><span class=
"hl-1">2</span><span class=
"hl-0">,
</span><span class=
"hl-1">3</span><span class=
"hl-0">,
</span><span class=
"hl-1">4</span><span class=
"hl-0">,
</span><span class=
"hl-1">5</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-7">// Prints:
</span><br/><span class=
"hl-7">// [
</span><br/><span class=
"hl-7">// [Function: firstListener],
</span><br/><span class=
"hl-7">// [Function: secondListener],
</span><br/><span class=
"hl-7">// [Function: thirdListener]
</span><br/><span class=
"hl-7">// ]
</span><br/><span class=
"hl-7">// Helloooo! first listener
</span><br/><span class=
"hl-7">// event with parameters
1,
2 in second listener
</span><br/><span class=
"hl-7">// event with parameters
1,
2,
3,
4,
5 in third listener
</span>
161 </code><button>Copy
</button></pre>
163 <h3>Since
</h3><p>v0.1
.26</p>
165 <div class=
"tsd-parameters">
166 <h4 class=
"tsd-parameters-title">Parameters
</h4>
167 <ul class=
"tsd-parameter-list">
169 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li>
171 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
172 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">boolean
</span></h4><aside class=
"tsd-sources">
173 <p>Inherited from EventEmitter.emit
</p>
175 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
610</li></ul></aside></li></ul></section>
176 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"eventNames" class=
"tsd-anchor"></a>
177 <h3 class=
"tsd-anchor-link"><span>event
<wbr/>Names
</span><a href=
"#eventNames" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
178 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
179 <li class=
"tsd-signature tsd-anchor-link" id=
"eventNames.eventNames-1"><span class=
"tsd-kind-call-signature">event
<wbr/>Names
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">[]
</span><a href=
"#eventNames.eventNames-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
180 <li class=
"tsd-description">
181 <div class=
"tsd-comment tsd-typography"><p>Returns an array listing the events for which the emitter has registered
182 listeners. The values in the array are strings or
<code>Symbol
</code>s.
</p>
183 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEE
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {});
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'bar
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {});
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">sym
</span><span class=
"hl-0"> =
</span><span class=
"hl-2">Symbol
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'symbol
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-3">sym
</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {});
</span><br/><br/><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">eventNames
</span><span class=
"hl-0">());
</span><br/><span class=
"hl-7">// Prints: [
'foo
',
'bar
', Symbol(symbol) ]
</span>
184 </code><button>Copy
</button></pre>
186 <h3>Since
</h3><p>v6.0
.0</p>
188 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">[]
</span></h4><aside class=
"tsd-sources">
189 <p>Inherited from EventEmitter.eventNames
</p>
191 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
673</li></ul></aside></li></ul></section>
192 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"getMaxListeners" class=
"tsd-anchor"></a>
193 <h3 class=
"tsd-anchor-link"><span>get
<wbr/>Max
<wbr/>Listeners
</span><a href=
"#getMaxListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
194 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
195 <li class=
"tsd-signature tsd-anchor-link" id=
"getMaxListeners.getMaxListeners-1"><span class=
"tsd-kind-call-signature">get
<wbr/>Max
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">number
</span><a href=
"#getMaxListeners.getMaxListeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
196 <li class=
"tsd-description">
197 <div class=
"tsd-comment tsd-typography"><p>Returns the current max listener value for the
<code>EventEmitter
</code> which is either
198 set by
<code>emitter.setMaxListeners(n)
</code> or defaults to
<a href=
"PoolEmitter.html#defaultMaxListeners" class=
"tsd-kind-property">defaultMaxListeners
</a>.
</p>
200 <h3>Since
</h3><p>v1.0
.0</p>
202 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">number
</span></h4><aside class=
"tsd-sources">
203 <p>Inherited from EventEmitter.getMaxListeners
</p>
205 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
526</li></ul></aside></li></ul></section>
206 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"listenerCount" class=
"tsd-anchor"></a>
207 <h3 class=
"tsd-anchor-link"><span>listener
<wbr/>Count
</span><a href=
"#listenerCount" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
208 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
209 <li class=
"tsd-signature tsd-anchor-link" id=
"listenerCount.listenerCount-1"><span class=
"tsd-kind-call-signature">listener
<wbr/>Count
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">number
</span><a href=
"#listenerCount.listenerCount-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
210 <li class=
"tsd-description">
211 <div class=
"tsd-comment tsd-typography"><p>Returns the number of listeners listening to the event named
<code>eventName
</code>.
</p>
212 <p>If
<code>listener
</code> is provided, it will return how many times the listener
213 is found in the list of the listeners of the event.
</p>
215 <h3>Since
</h3><p>v3.2
.0</p>
217 <div class=
"tsd-parameters">
218 <h4 class=
"tsd-parameters-title">Parameters
</h4>
219 <ul class=
"tsd-parameter-list">
221 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
222 <div class=
"tsd-comment tsd-typography"><p>The name of the event being listened for
</p>
225 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-type ">Function
</span></h5>
226 <div class=
"tsd-comment tsd-typography"><p>The event handler function
</p>
227 </div></li></ul></div>
228 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">number
</span></h4><aside class=
"tsd-sources">
229 <p>Inherited from EventEmitter.listenerCount
</p>
231 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
620</li></ul></aside></li></ul></section>
232 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"listeners" class=
"tsd-anchor"></a>
233 <h3 class=
"tsd-anchor-link"><span>listeners
</span><a href=
"#listeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
234 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
235 <li class=
"tsd-signature tsd-anchor-link" id=
"listeners.listeners-1"><span class=
"tsd-kind-call-signature">listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span><a href=
"#listeners.listeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
236 <li class=
"tsd-description">
237 <div class=
"tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named
<code>eventName
</code>.
</p>
238 <pre><code class=
"language-js"><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">, (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'someone connected!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span><br/><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">util
</span><span class=
"hl-0">.
</span><span class=
"hl-2">inspect
</span><span class=
"hl-0">(
</span><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">listeners
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">)));
</span><br/><span class=
"hl-7">// Prints: [ [Function] ]
</span>
239 </code><button>Copy
</button></pre>
241 <h3>Since
</h3><p>v0.1
.26</p>
243 <div class=
"tsd-parameters">
244 <h4 class=
"tsd-parameters-title">Parameters
</h4>
245 <ul class=
"tsd-parameter-list">
247 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li></ul></div>
248 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span></h4><aside class=
"tsd-sources">
249 <p>Inherited from EventEmitter.listeners
</p>
251 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
539</li></ul></aside></li></ul></section>
252 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"off" class=
"tsd-anchor"></a>
253 <h3 class=
"tsd-anchor-link"><span>off
</span><a href=
"#off" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
254 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
255 <li class=
"tsd-signature tsd-anchor-link" id=
"off.off-1"><span class=
"tsd-kind-call-signature">off
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#off.off-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
256 <li class=
"tsd-description">
257 <div class=
"tsd-comment tsd-typography"><p>Alias for
<code>emitter.removeListener()
</code>.
</p>
259 <h3>Since
</h3><p>v10.0
.0</p>
261 <div class=
"tsd-parameters">
262 <h4 class=
"tsd-parameters-title">Parameters
</h4>
263 <ul class=
"tsd-parameter-list">
265 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li>
267 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
268 <ul class=
"tsd-parameters">
269 <li class=
"tsd-parameter-signature">
270 <ul class=
"tsd-signatures tsd-is-external">
271 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
272 <li class=
"tsd-description">
273 <div class=
"tsd-parameters">
274 <h4 class=
"tsd-parameters-title">Parameters
</h4>
275 <ul class=
"tsd-parameter-list">
277 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
278 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
279 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
280 <p>Inherited from EventEmitter.off
</p>
282 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
499</li></ul></aside></li></ul></section>
283 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"on" class=
"tsd-anchor"></a>
284 <h3 class=
"tsd-anchor-link"><span>on
</span><a href=
"#on" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
285 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
286 <li class=
"tsd-signature tsd-anchor-link" id=
"on.on-1"><span class=
"tsd-kind-call-signature">on
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#on.on-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
287 <li class=
"tsd-description">
288 <div class=
"tsd-comment tsd-typography"><p>Adds the
<code>listener
</code> function to the end of the listeners array for the
289 event named
<code>eventName
</code>. No checks are made to see if the
<code>listener
</code> has
290 already been added. Multiple calls passing the same combination of
<code>eventName
</code>and
<code>listener
</code> will result in the
<code>listener
</code> being added, and called, multiple
292 <pre><code class=
"language-js"><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">, (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'someone connected!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span>
293 </code><button>Copy
</button></pre>
294 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
295 <p>By default, event listeners are invoked in the order they are added. The
<code>emitter.prependListener()
</code> method can be used as an alternative to add the
296 event listener to the beginning of the listeners array.
</p>
297 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEE
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'a
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">prependListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'b
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-7">// Prints:
</span><br/><span class=
"hl-7">// b
</span><br/><span class=
"hl-7">// a
</span>
298 </code><button>Copy
</button></pre>
300 <h3>Since
</h3><p>v0.1
.101</p>
302 <div class=
"tsd-parameters">
303 <h4 class=
"tsd-parameters-title">Parameters
</h4>
304 <ul class=
"tsd-parameter-list">
306 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
307 <div class=
"tsd-comment tsd-typography"><p>The name of the event.
</p>
310 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
311 <div class=
"tsd-comment tsd-typography"><p>The callback function
</p>
313 <ul class=
"tsd-parameters">
314 <li class=
"tsd-parameter-signature">
315 <ul class=
"tsd-signatures tsd-is-external">
316 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
317 <li class=
"tsd-description">
318 <div class=
"tsd-parameters">
319 <h4 class=
"tsd-parameters-title">Parameters
</h4>
320 <ul class=
"tsd-parameter-list">
322 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
323 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
324 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
325 <p>Inherited from EventEmitter.on
</p>
327 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
385</li></ul></aside></li></ul></section>
328 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"once" class=
"tsd-anchor"></a>
329 <h3 class=
"tsd-anchor-link"><span>once
</span><a href=
"#once" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
330 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
331 <li class=
"tsd-signature tsd-anchor-link" id=
"once.once-1"><span class=
"tsd-kind-call-signature">once
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#once.once-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
332 <li class=
"tsd-description">
333 <div class=
"tsd-comment tsd-typography"><p>Adds a
<strong>one-time
</strong><code>listener
</code> function for the event named
<code>eventName
</code>. The
334 next time
<code>eventName
</code> is triggered, this listener is removed and then invoked.
</p>
335 <pre><code class=
"language-js"><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">, (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Ah, we have our first user!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span>
336 </code><button>Copy
</button></pre>
337 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
338 <p>By default, event listeners are invoked in the order they are added. The
<code>emitter.prependOnceListener()
</code> method can be used as an alternative to add the
339 event listener to the beginning of the listeners array.
</p>
340 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEE
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'a
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">prependOnceListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'b
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-3">myEE
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-7">// Prints:
</span><br/><span class=
"hl-7">// b
</span><br/><span class=
"hl-7">// a
</span>
341 </code><button>Copy
</button></pre>
343 <h3>Since
</h3><p>v0.3
.0</p>
345 <div class=
"tsd-parameters">
346 <h4 class=
"tsd-parameters-title">Parameters
</h4>
347 <ul class=
"tsd-parameter-list">
349 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
350 <div class=
"tsd-comment tsd-typography"><p>The name of the event.
</p>
353 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
354 <div class=
"tsd-comment tsd-typography"><p>The callback function
</p>
356 <ul class=
"tsd-parameters">
357 <li class=
"tsd-parameter-signature">
358 <ul class=
"tsd-signatures tsd-is-external">
359 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
360 <li class=
"tsd-description">
361 <div class=
"tsd-parameters">
362 <h4 class=
"tsd-parameters-title">Parameters
</h4>
363 <ul class=
"tsd-parameter-list">
365 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
366 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
367 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
368 <p>Inherited from EventEmitter.once
</p>
370 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
414</li></ul></aside></li></ul></section>
371 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"prependListener" class=
"tsd-anchor"></a>
372 <h3 class=
"tsd-anchor-link"><span>prepend
<wbr/>Listener
</span><a href=
"#prependListener" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
373 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
374 <li class=
"tsd-signature tsd-anchor-link" id=
"prependListener.prependListener-1"><span class=
"tsd-kind-call-signature">prepend
<wbr/>Listener
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#prependListener.prependListener-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
375 <li class=
"tsd-description">
376 <div class=
"tsd-comment tsd-typography"><p>Adds the
<code>listener
</code> function to the
<em>beginning
</em> of the listeners array for the
377 event named
<code>eventName
</code>. No checks are made to see if the
<code>listener
</code> has
378 already been added. Multiple calls passing the same combination of
<code>eventName
</code>and
<code>listener
</code> will result in the
<code>listener
</code> being added, and called, multiple
380 <pre><code class=
"language-js"><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">prependListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">, (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'someone connected!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span>
381 </code><button>Copy
</button></pre>
382 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
384 <h3>Since
</h3><p>v6.0
.0</p>
386 <div class=
"tsd-parameters">
387 <h4 class=
"tsd-parameters-title">Parameters
</h4>
388 <ul class=
"tsd-parameter-list">
390 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
391 <div class=
"tsd-comment tsd-typography"><p>The name of the event.
</p>
394 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
395 <div class=
"tsd-comment tsd-typography"><p>The callback function
</p>
397 <ul class=
"tsd-parameters">
398 <li class=
"tsd-parameter-signature">
399 <ul class=
"tsd-signatures tsd-is-external">
400 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
401 <li class=
"tsd-description">
402 <div class=
"tsd-parameters">
403 <h4 class=
"tsd-parameters-title">Parameters
</h4>
404 <ul class=
"tsd-parameter-list">
406 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
407 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
408 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
409 <p>Inherited from EventEmitter.prependListener
</p>
411 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
638</li></ul></aside></li></ul></section>
412 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"prependOnceListener" class=
"tsd-anchor"></a>
413 <h3 class=
"tsd-anchor-link"><span>prepend
<wbr/>Once
<wbr/>Listener
</span><a href=
"#prependOnceListener" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
414 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
415 <li class=
"tsd-signature tsd-anchor-link" id=
"prependOnceListener.prependOnceListener-1"><span class=
"tsd-kind-call-signature">prepend
<wbr/>Once
<wbr/>Listener
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#prependOnceListener.prependOnceListener-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
416 <li class=
"tsd-description">
417 <div class=
"tsd-comment tsd-typography"><p>Adds a
<strong>one-time
</strong><code>listener
</code> function for the event named
<code>eventName
</code> to the
<em>beginning
</em> of the listeners array. The next time
<code>eventName
</code> is triggered, this
418 listener is removed, and then invoked.
</p>
419 <pre><code class=
"language-js"><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">prependOnceListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">, (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Ah, we have our first user!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">});
</span>
420 </code><button>Copy
</button></pre>
421 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
423 <h3>Since
</h3><p>v6.0
.0</p>
425 <div class=
"tsd-parameters">
426 <h4 class=
"tsd-parameters-title">Parameters
</h4>
427 <ul class=
"tsd-parameter-list">
429 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
430 <div class=
"tsd-comment tsd-typography"><p>The name of the event.
</p>
433 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
434 <div class=
"tsd-comment tsd-typography"><p>The callback function
</p>
436 <ul class=
"tsd-parameters">
437 <li class=
"tsd-parameter-signature">
438 <ul class=
"tsd-signatures tsd-is-external">
439 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
440 <li class=
"tsd-description">
441 <div class=
"tsd-parameters">
442 <h4 class=
"tsd-parameters-title">Parameters
</h4>
443 <ul class=
"tsd-parameter-list">
445 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
446 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
447 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
448 <p>Inherited from EventEmitter.prependOnceListener
</p>
450 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
654</li></ul></aside></li></ul></section>
451 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"rawListeners" class=
"tsd-anchor"></a>
452 <h3 class=
"tsd-anchor-link"><span>raw
<wbr/>Listeners
</span><a href=
"#rawListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
453 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
454 <li class=
"tsd-signature tsd-anchor-link" id=
"rawListeners.rawListeners-1"><span class=
"tsd-kind-call-signature">raw
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span><a href=
"#rawListeners.rawListeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
455 <li class=
"tsd-description">
456 <div class=
"tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named
<code>eventName
</code>,
457 including any wrappers (such as those created by
<code>.once()
</code>).
</p>
458 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">emitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-3">emitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log once
'</span><span class=
"hl-0">));
</span><br/><br/><span class=
"hl-7">// Returns a new Array with a function `onceWrapper` which has a property
</span><br/><span class=
"hl-7">// `listener` which contains the original listener bound above
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">listeners
</span><span class=
"hl-0"> =
</span><span class=
"hl-3">emitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">rawListeners
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">logFnWrapper
</span><span class=
"hl-0"> =
</span><span class=
"hl-3">listeners
</span><span class=
"hl-0">[
</span><span class=
"hl-1">0</span><span class=
"hl-0">];
</span><br/><br/><span class=
"hl-7">// Logs
"log once
" to the console and does not unbind the `once` event
</span><br/><span class=
"hl-3">logFnWrapper
</span><span class=
"hl-0">.
</span><span class=
"hl-2">listener
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-7">// Logs
"log once
" to the console and removes the listener
</span><br/><span class=
"hl-2">logFnWrapper
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-3">emitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log persistently
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-7">// Will return a new Array with a single function bound by `.on()` above
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">newListeners
</span><span class=
"hl-0"> =
</span><span class=
"hl-3">emitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">rawListeners
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-7">// Logs
"log persistently
" twice
</span><br/><span class=
"hl-3">newListeners
</span><span class=
"hl-0">[
</span><span class=
"hl-1">0</span><span class=
"hl-0">]();
</span><br/><span class=
"hl-3">emitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'log
'</span><span class=
"hl-0">);
</span>
459 </code><button>Copy
</button></pre>
461 <h3>Since
</h3><p>v9.4
.0</p>
463 <div class=
"tsd-parameters">
464 <h4 class=
"tsd-parameters-title">Parameters
</h4>
465 <ul class=
"tsd-parameter-list">
467 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li></ul></div>
468 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span></h4><aside class=
"tsd-sources">
469 <p>Inherited from EventEmitter.rawListeners
</p>
471 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
569</li></ul></aside></li></ul></section>
472 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"removeAllListeners" class=
"tsd-anchor"></a>
473 <h3 class=
"tsd-anchor-link"><span>remove
<wbr/>All
<wbr/>Listeners
</span><a href=
"#removeAllListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
474 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
475 <li class=
"tsd-signature tsd-anchor-link" id=
"removeAllListeners.removeAllListeners-1"><span class=
"tsd-kind-call-signature">remove
<wbr/>All
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">event
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#removeAllListeners.removeAllListeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
476 <li class=
"tsd-description">
477 <div class=
"tsd-comment tsd-typography"><p>Removes all listeners, or those of the specified
<code>eventName
</code>.
</p>
478 <p>It is bad practice to remove listeners added elsewhere in the code,
479 particularly when the
<code>EventEmitter
</code> instance was created by some other
480 component or module (e.g. sockets or file streams).
</p>
481 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
483 <h3>Since
</h3><p>v0.1
.26</p>
485 <div class=
"tsd-parameters">
486 <h4 class=
"tsd-parameters-title">Parameters
</h4>
487 <ul class=
"tsd-parameter-list">
489 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">event
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li></ul></div>
490 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
491 <p>Inherited from EventEmitter.removeAllListeners
</p>
493 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
510</li></ul></aside></li></ul></section>
494 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"removeListener" class=
"tsd-anchor"></a>
495 <h3 class=
"tsd-anchor-link"><span>remove
<wbr/>Listener
</span><a href=
"#removeListener" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
496 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
497 <li class=
"tsd-signature tsd-anchor-link" id=
"removeListener.removeListener-1"><span class=
"tsd-kind-call-signature">remove
<wbr/>Listener
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">listener
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#removeListener.removeListener-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
498 <li class=
"tsd-description">
499 <div class=
"tsd-comment tsd-typography"><p>Removes the specified
<code>listener
</code> from the listener array for the event named
<code>eventName
</code>.
</p>
500 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-2">callback
</span><span class=
"hl-0"> = (
</span><span class=
"hl-3">stream
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'someone connected!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">};
</span><br/><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">callback
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-7">// ...
</span><br/><span class=
"hl-3">server
</span><span class=
"hl-0">.
</span><span class=
"hl-2">removeListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'connection
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">callback
</span><span class=
"hl-0">);
</span>
501 </code><button>Copy
</button></pre>
502 <p><code>removeListener()
</code> will remove, at most, one instance of a listener from the
503 listener array. If any single listener has been added multiple times to the
504 listener array for the specified
<code>eventName
</code>, then
<code>removeListener()
</code> must be
505 called multiple times to remove each instance.
</p>
506 <p>Once an event is emitted, all listeners attached to it at the
507 time of emitting are called in order. This implies that any
<code>removeListener()
</code> or
<code>removeAllListeners()
</code> calls
<em>after
</em> emitting and
<em>before
</em> the last listener finishes execution
508 will not remove them from
<code>emit()
</code> in progress. Subsequent events behave as expected.
</p>
509 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEmitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">MyEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-2">callbackA
</span><span class=
"hl-0"> = ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'A
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">removeListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">callbackB
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">};
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-2">callbackB
</span><span class=
"hl-0"> = ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'B
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">};
</span><br/><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">callbackA
</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">callbackB
</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-7">// callbackA removes listener callbackB but it will still be called.
</span><br/><span class=
"hl-7">// Internal listener array at time of emit [callbackA, callbackB]
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-7">// Prints:
</span><br/><span class=
"hl-7">// A
</span><br/><span class=
"hl-7">// B
</span><br/><br/><span class=
"hl-7">// callbackB is now removed.
</span><br/><span class=
"hl-7">// Internal listener array [callbackA]
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-7">// Prints:
</span><br/><span class=
"hl-7">// A
</span>
510 </code><button>Copy
</button></pre>
511 <p>Because listeners are managed using an internal array, calling this will
512 change the position indices of any listener registered
<em>after
</em> the listener
513 being removed. This will not impact the order in which listeners are called,
514 but it means that any copies of the listener array as returned by
515 the
<code>emitter.listeners()
</code> method will need to be recreated.
</p>
516 <p>When a single function has been added as a handler multiple times for a single
517 event (as in the example below),
<code>removeListener()
</code> will remove the most
518 recently added instance. In the example the
<code>once(
'ping
')
</code>listener is removed:
</p>
519 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">pong
</span><span class=
"hl-0">() {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'pong
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0">}
</span><br/><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ping
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">pong
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ping
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">pong
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">removeListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ping
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">pong
</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ping
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ping
'</span><span class=
"hl-0">);
</span>
520 </code><button>Copy
</button></pre>
521 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
523 <h3>Since
</h3><p>v0.1
.26</p>
525 <div class=
"tsd-parameters">
526 <h4 class=
"tsd-parameters-title">Parameters
</h4>
527 <ul class=
"tsd-parameter-list">
529 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li>
531 <h5><span class=
"tsd-kind-parameter">listener
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">void
</span><span class=
"tsd-signature-symbol">)
</span></h5>
532 <ul class=
"tsd-parameters">
533 <li class=
"tsd-parameter-signature">
534 <ul class=
"tsd-signatures tsd-is-external">
535 <li class=
"tsd-signature"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
536 <li class=
"tsd-description">
537 <div class=
"tsd-parameters">
538 <h4 class=
"tsd-parameters-title">Parameters
</h4>
539 <ul class=
"tsd-parameter-list">
541 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">args
</span>:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
542 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4></li></ul></li></ul></li></ul></div>
543 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
544 <p>Inherited from EventEmitter.removeListener
</p>
546 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
494</li></ul></aside></li></ul></section>
547 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"setMaxListeners" class=
"tsd-anchor"></a>
548 <h3 class=
"tsd-anchor-link"><span>set
<wbr/>Max
<wbr/>Listeners
</span><a href=
"#setMaxListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
549 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
550 <li class=
"tsd-signature tsd-anchor-link" id=
"setMaxListeners.setMaxListeners-1"><span class=
"tsd-kind-call-signature">set
<wbr/>Max
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">n
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a><a href=
"#setMaxListeners.setMaxListeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
551 <li class=
"tsd-description">
552 <div class=
"tsd-comment tsd-typography"><p>By default
<code>EventEmitter
</code>s will print a warning if more than
<code>10</code> listeners are
553 added for a particular event. This is a useful default that helps finding
554 memory leaks. The
<code>emitter.setMaxListeners()
</code> method allows the limit to be
555 modified for this specific
<code>EventEmitter
</code> instance. The value can be set to
<code>Infinity
</code> (or
<code>0</code>) to indicate an unlimited number of listeners.
</p>
556 <p>Returns a reference to the
<code>EventEmitter
</code>, so that calls can be chained.
</p>
558 <h3>Since
</h3><p>v0.3
.5</p>
560 <div class=
"tsd-parameters">
561 <h4 class=
"tsd-parameters-title">Parameters
</h4>
562 <ul class=
"tsd-parameter-list">
564 <h5><span class=
"tsd-kind-parameter">n
</span>:
<span class=
"tsd-signature-type">number
</span></h5></li></ul></div>
565 <h4 class=
"tsd-returns-title">Returns
<a href=
"PoolEmitter.html" class=
"tsd-signature-type tsd-kind-class">PoolEmitter
</a></h4><aside class=
"tsd-sources">
566 <p>Inherited from EventEmitter.setMaxListeners
</p>
568 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
520</li></ul></aside></li></ul></section>
569 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"getEventListeners" class=
"tsd-anchor"></a>
570 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>get
<wbr/>Event
<wbr/>Listeners
</span><a href=
"#getEventListeners" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
571 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
572 <li class=
"tsd-signature tsd-anchor-link" id=
"getEventListeners.getEventListeners-1"><span class=
"tsd-kind-call-signature">get
<wbr/>Event
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">emitter
</span>,
<span class=
"tsd-kind-parameter">name
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span><a href=
"#getEventListeners.getEventListeners-1" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
573 <li class=
"tsd-description">
574 <div class=
"tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named
<code>eventName
</code>.
</p>
575 <p>For
<code>EventEmitter
</code>s this behaves exactly the same as calling
<code>.listeners
</code> on
577 <p>For
<code>EventTarget
</code>s this is the only way to get the event listeners for the
578 event target. This is useful for debugging and diagnostic purposes.
</p>
579 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">getEventListeners
</span><span class=
"hl-0">,
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-0">{
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-2">listener
</span><span class=
"hl-0"> = ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Events are fun
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">listener
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-2">getEventListeners
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">);
</span><span class=
"hl-7">// [listener]
</span><br/><span class=
"hl-0">}
</span><br/><span class=
"hl-0">{
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">et
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventTarget
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-2">listener
</span><span class=
"hl-0"> = ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Events are fun
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">et
</span><span class=
"hl-0">.
</span><span class=
"hl-2">addEventListener
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">listener
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-2">getEventListeners
</span><span class=
"hl-0">(
</span><span class=
"hl-3">et
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">);
</span><span class=
"hl-7">// [listener]
</span><br/><span class=
"hl-0">}
</span>
580 </code><button>Copy
</button></pre>
582 <h3>Since
</h3><p>v15.2
.0, v14.17
.0</p>
584 <div class=
"tsd-parameters">
585 <h4 class=
"tsd-parameters-title">Parameters
</h4>
586 <ul class=
"tsd-parameter-list">
588 <h5><span class=
"tsd-kind-parameter">emitter
</span>:
<span class=
"tsd-signature-type ">EventEmitter
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type ">_DOMEventTarget
</span></h5></li>
590 <h5><span class=
"tsd-kind-parameter">name
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li></ul></div>
591 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">Function
</span><span class=
"tsd-signature-symbol">[]
</span></h4><aside class=
"tsd-sources">
592 <p>Inherited from EventEmitter.getEventListeners
</p>
594 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
299</li></ul></aside></li></ul></section>
595 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"listenerCount-2" class=
"tsd-anchor"></a>
596 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>listener
<wbr/>Count
</span><a href=
"#listenerCount-2" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
597 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
598 <li class=
"tsd-signature tsd-anchor-link" id=
"listenerCount-2.listenerCount-3"><span class=
"tsd-kind-call-signature">listener
<wbr/>Count
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">emitter
</span>,
<span class=
"tsd-kind-parameter">eventName
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">number
</span><a href=
"#listenerCount-2.listenerCount-3" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
599 <li class=
"tsd-description">
600 <div class=
"tsd-comment tsd-typography"><p>A class method that returns the number of listeners for the given
<code>eventName
</code>registered on the given
<code>emitter
</code>.
</p>
601 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0">,
</span><span class=
"hl-5">listenerCount
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">myEmitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {});
</span><br/><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">.
</span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">, ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {});
</span><br/><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-2">listenerCount
</span><span class=
"hl-0">(
</span><span class=
"hl-3">myEmitter
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'event
'</span><span class=
"hl-0">));
</span><br/><span class=
"hl-7">// Prints:
2</span>
602 </code><button>Copy
</button></pre>
604 <h3>Since
</h3><p>v0.9
.12</p>
606 <h3>Deprecated
</h3><p>Since v3.2
.0 - Use
<code>listenerCount
</code> instead.
</p>
608 <div class=
"tsd-parameters">
609 <h4 class=
"tsd-parameters-title">Parameters
</h4>
610 <ul class=
"tsd-parameter-list">
612 <h5><span class=
"tsd-kind-parameter">emitter
</span>:
<span class=
"tsd-signature-type ">EventEmitter
</span></h5>
613 <div class=
"tsd-comment tsd-typography"><p>The emitter to query
</p>
616 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5>
617 <div class=
"tsd-comment tsd-typography"><p>The event name
</p>
618 </div></li></ul></div>
619 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">number
</span></h4><aside class=
"tsd-sources">
620 <p>Inherited from EventEmitter.listenerCount
</p>
622 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
271</li></ul></aside></li></ul></section>
623 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"on-2" class=
"tsd-anchor"></a>
624 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>on
</span><a href=
"#on-2" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
625 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
626 <li class=
"tsd-signature tsd-anchor-link" id=
"on-2.on-3"><span class=
"tsd-kind-call-signature">on
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">emitter
</span>,
<span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">options
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">AsyncIterableIterator
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">></span><a href=
"#on-2.on-3" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
627 <li class=
"tsd-description">
628 <div class=
"tsd-comment tsd-typography"><pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">on
</span><span class=
"hl-0">,
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-0">(
</span><span class=
"hl-4">async
</span><span class=
"hl-0"> ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-7">// Emit later on
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">process
</span><span class=
"hl-0">.
</span><span class=
"hl-2">nextTick
</span><span class=
"hl-0">(()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-6">'bar
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-1">42</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> });
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-8">for
</span><span class=
"hl-0"> </span><span class=
"hl-8">await
</span><span class=
"hl-0"> (
</span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">event
</span><span class=
"hl-0"> </span><span class=
"hl-4">of
</span><span class=
"hl-0"> </span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">)) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// The execution of this inner block is synchronous and it
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// processes one event at a time (even with await). Do not use
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// if concurrent execution is required.
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">event
</span><span class=
"hl-0">);
</span><span class=
"hl-7">// prints [
'bar
'] [
42]
</span><br/><span class=
"hl-0"> }
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// Unreachable here
</span><br/><span class=
"hl-0">})();
</span>
629 </code><button>Copy
</button></pre>
630 <p>Returns an
<code>AsyncIterator
</code> that iterates
<code>eventName
</code> events. It will throw
631 if the
<code>EventEmitter
</code> emits
<code>'error
'</code>. It removes all listeners when
632 exiting the loop. The
<code>value
</code> returned by each iteration is an array
633 composed of the emitted event arguments.
</p>
634 <p>An
<code>AbortSignal
</code> can be used to cancel waiting on events:
</p>
635 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">on
</span><span class=
"hl-0">,
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ac
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">AbortController
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-0">(
</span><span class=
"hl-4">async
</span><span class=
"hl-0"> ()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-7">// Emit later on
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">process
</span><span class=
"hl-0">.
</span><span class=
"hl-2">nextTick
</span><span class=
"hl-0">(()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-6">'bar
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-1">42</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> });
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-8">for
</span><span class=
"hl-0"> </span><span class=
"hl-8">await
</span><span class=
"hl-0"> (
</span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">event
</span><span class=
"hl-0"> </span><span class=
"hl-4">of
</span><span class=
"hl-0"> </span><span class=
"hl-2">on
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">, {
</span><span class=
"hl-3">signal:
</span><span class=
"hl-0"> </span><span class=
"hl-3">ac
</span><span class=
"hl-0">.
</span><span class=
"hl-3">signal
</span><span class=
"hl-0"> })) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// The execution of this inner block is synchronous and it
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// processes one event at a time (even with await). Do not use
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// if concurrent execution is required.
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">event
</span><span class=
"hl-0">);
</span><span class=
"hl-7">// prints [
'bar
'] [
42]
</span><br/><span class=
"hl-0"> }
</span><br/><span class=
"hl-0"> </span><span class=
"hl-7">// Unreachable here
</span><br/><span class=
"hl-0">})();
</span><br/><br/><span class=
"hl-3">process
</span><span class=
"hl-0">.
</span><span class=
"hl-2">nextTick
</span><span class=
"hl-0">(()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">ac
</span><span class=
"hl-0">.
</span><span class=
"hl-2">abort
</span><span class=
"hl-0">());
</span>
636 </code><button>Copy
</button></pre>
638 <h3>Since
</h3><p>v13.6
.0, v12.16
.0</p>
640 <div class=
"tsd-parameters">
641 <h4 class=
"tsd-parameters-title">Parameters
</h4>
642 <ul class=
"tsd-parameter-list">
644 <h5><span class=
"tsd-kind-parameter">emitter
</span>:
<span class=
"tsd-signature-type ">EventEmitter
</span></h5></li>
646 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span></h5>
647 <div class=
"tsd-comment tsd-typography"><p>The name of the event being listened for
</p>
650 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">options
</span>:
<span class=
"tsd-signature-type ">StaticEventEmitterOptions
</span></h5></li></ul></div>
651 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">AsyncIterableIterator
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">></span></h4><p>that iterates
<code>eventName
</code> events emitted by the
<code>emitter
</code></p>
652 <aside class=
"tsd-sources">
653 <p>Inherited from EventEmitter.on
</p>
655 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
254</li></ul></aside></li></ul></section>
656 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"once-2" class=
"tsd-anchor"></a>
657 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>once
</span><a href=
"#once-2" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
658 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
659 <li class=
"tsd-signature tsd-anchor-link" id=
"once-2.once-3"><span class=
"tsd-kind-call-signature">once
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">emitter
</span>,
<span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">options
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span><span class=
"tsd-signature-symbol">></span><a href=
"#once-2.once-3" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
660 <li class=
"tsd-description">
661 <div class=
"tsd-comment tsd-typography"><p>Creates a
<code>Promise
</code> that is fulfilled when the
<code>EventEmitter
</code> emits the given
662 event or that is rejected if the
<code>EventEmitter
</code> emits
<code>'error
'</code> while waiting.
663 The
<code>Promise
</code> will resolve with an array of all the arguments emitted to the
665 <p>This method is intentionally generic and works with the web platform
<a href=
"https://dom.spec.whatwg.org/#interface-eventtarget">EventTarget
</a> interface, which has no special
<code>'error
'</code> event
666 semantics and does not listen to the
<code>'error
'</code> event.
</p>
667 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">once
</span><span class=
"hl-0">,
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-4">async
</span><span class=
"hl-0"> </span><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">run
</span><span class=
"hl-0">() {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-3">process
</span><span class=
"hl-0">.
</span><span class=
"hl-2">nextTick
</span><span class=
"hl-0">(()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'myevent
'</span><span class=
"hl-0">,
</span><span class=
"hl-1">42</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> });
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> [
</span><span class=
"hl-5">value
</span><span class=
"hl-0">] =
</span><span class=
"hl-8">await
</span><span class=
"hl-0"> </span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'myevent
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-3">value
</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">err
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">Error
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'kaboom
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">process
</span><span class=
"hl-0">.
</span><span class=
"hl-2">nextTick
</span><span class=
"hl-0">(()
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'error
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">err
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> });
</span><br/><br/><span class=
"hl-0"> </span><span class=
"hl-8">try
</span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-8">await
</span><span class=
"hl-0"> </span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'myevent
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> }
</span><span class=
"hl-8">catch
</span><span class=
"hl-0"> (
</span><span class=
"hl-3">err
</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'error happened
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">err
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> }
</span><br/><span class=
"hl-0">}
</span><br/><br/><span class=
"hl-2">run
</span><span class=
"hl-0">();
</span>
668 </code><button>Copy
</button></pre>
669 <p>The special handling of the
<code>'error
'</code> event is only used when
<code>events.once()
</code>is used to wait for another event. If
<code>events.once()
</code> is used to wait for the
670 '<code>error
'</code> event itself, then it is treated as any other kind of event without
671 special handling:
</p>
672 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0">,
</span><span class=
"hl-5">once
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'error
'</span><span class=
"hl-0">)
</span><br/><span class=
"hl-0"> .
</span><span class=
"hl-2">then
</span><span class=
"hl-0">(([
</span><span class=
"hl-3">err
</span><span class=
"hl-0">])
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'ok
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">err
</span><span class=
"hl-0">.
</span><span class=
"hl-3">message
</span><span class=
"hl-0">))
</span><br/><span class=
"hl-0"> .
</span><span class=
"hl-2">catch
</span><span class=
"hl-0">((
</span><span class=
"hl-3">err
</span><span class=
"hl-0">)
</span><span class=
"hl-4">=
></span><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'error
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">err
</span><span class=
"hl-0">.
</span><span class=
"hl-3">message
</span><span class=
"hl-0">));
</span><br/><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'error
'</span><span class=
"hl-0">,
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">Error
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'boom
'</span><span class=
"hl-0">));
</span><br/><br/><span class=
"hl-7">// Prints: ok boom
</span>
673 </code><button>Copy
</button></pre>
674 <p>An
<code>AbortSignal
</code> can be used to cancel waiting for the event:
</p>
675 <pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><span class=
"hl-5">EventEmitter
</span><span class=
"hl-0">,
</span><span class=
"hl-5">once
</span><span class=
"hl-0"> } =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ee
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">ac
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">AbortController
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-4">async
</span><span class=
"hl-0"> </span><span class=
"hl-4">function
</span><span class=
"hl-0"> </span><span class=
"hl-2">foo
</span><span class=
"hl-0">(
</span><span class=
"hl-3">emitter
</span><span class=
"hl-0">,
</span><span class=
"hl-3">event
</span><span class=
"hl-0">,
</span><span class=
"hl-3">signal
</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-8">try
</span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-8">await
</span><span class=
"hl-0"> </span><span class=
"hl-2">once
</span><span class=
"hl-0">(
</span><span class=
"hl-3">emitter
</span><span class=
"hl-0">,
</span><span class=
"hl-3">event
</span><span class=
"hl-0">, {
</span><span class=
"hl-3">signal
</span><span class=
"hl-0"> });
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">log
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'event emitted!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> }
</span><span class=
"hl-8">catch
</span><span class=
"hl-0"> (
</span><span class=
"hl-3">error
</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-8">if
</span><span class=
"hl-0"> (
</span><span class=
"hl-3">error
</span><span class=
"hl-0">.
</span><span class=
"hl-3">name
</span><span class=
"hl-0"> ===
</span><span class=
"hl-6">'AbortError
'</span><span class=
"hl-0">) {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">error
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'Waiting for the event was canceled!
'</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> }
</span><span class=
"hl-8">else
</span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-3">console
</span><span class=
"hl-0">.
</span><span class=
"hl-2">error
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'There was an error
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">error
</span><span class=
"hl-0">.
</span><span class=
"hl-3">message
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-0"> }
</span><br/><span class=
"hl-0"> }
</span><br/><span class=
"hl-0">}
</span><br/><br/><span class=
"hl-2">foo
</span><span class=
"hl-0">(
</span><span class=
"hl-3">ee
</span><span class=
"hl-0">,
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">,
</span><span class=
"hl-3">ac
</span><span class=
"hl-0">.
</span><span class=
"hl-3">signal
</span><span class=
"hl-0">);
</span><br/><span class=
"hl-3">ac
</span><span class=
"hl-0">.
</span><span class=
"hl-2">abort
</span><span class=
"hl-0">();
</span><span class=
"hl-7">// Abort waiting for the event
</span><br/><span class=
"hl-3">ee
</span><span class=
"hl-0">.
</span><span class=
"hl-2">emit
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'foo
'</span><span class=
"hl-0">);
</span><span class=
"hl-7">// Prints: Waiting for the event was canceled!
</span>
676 </code><button>Copy
</button></pre>
678 <h3>Since
</h3><p>v11.13
.0, v10.16
.0</p>
680 <div class=
"tsd-parameters">
681 <h4 class=
"tsd-parameters-title">Parameters
</h4>
682 <ul class=
"tsd-parameter-list">
684 <h5><span class=
"tsd-kind-parameter">emitter
</span>:
<span class=
"tsd-signature-type ">_NodeEventTarget
</span></h5></li>
686 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">symbol
</span></h5></li>
688 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">options
</span>:
<span class=
"tsd-signature-type ">StaticEventEmitterOptions
</span></h5></li></ul></div>
689 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span><span class=
"tsd-signature-symbol">></span></h4><aside class=
"tsd-sources">
690 <p>Inherited from EventEmitter.once
</p>
692 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
194</li></ul></aside></li>
693 <li class=
"tsd-signature tsd-anchor-link" id=
"once-2.once-4"><span class=
"tsd-kind-call-signature">once
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">emitter
</span>,
<span class=
"tsd-kind-parameter">eventName
</span>,
<span class=
"tsd-kind-parameter">options
</span><span class=
"tsd-signature-symbol">?
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type ">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span><span class=
"tsd-signature-symbol">></span><a href=
"#once-2.once-4" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
694 <li class=
"tsd-description">
695 <div class=
"tsd-parameters">
696 <h4 class=
"tsd-parameters-title">Parameters
</h4>
697 <ul class=
"tsd-parameter-list">
699 <h5><span class=
"tsd-kind-parameter">emitter
</span>:
<span class=
"tsd-signature-type ">_DOMEventTarget
</span></h5></li>
701 <h5><span class=
"tsd-kind-parameter">eventName
</span>:
<span class=
"tsd-signature-type">string
</span></h5></li>
703 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">options
</span>:
<span class=
"tsd-signature-type ">StaticEventEmitterOptions
</span></h5></li></ul></div>
704 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type ">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span><span class=
"tsd-signature-symbol">></span></h4><aside class=
"tsd-sources">
705 <p>Inherited from EventEmitter.once
</p>
707 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
195</li></ul></aside></li></ul></section>
708 <section class=
"tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id=
"setMaxListeners-2" class=
"tsd-anchor"></a>
709 <h3 class=
"tsd-anchor-link"><code class=
"tsd-tag ts-flagStatic">Static
</code> <span>set
<wbr/>Max
<wbr/>Listeners
</span><a href=
"#setMaxListeners-2" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></h3>
710 <ul class=
"tsd-signatures tsd-is-inherited tsd-is-external">
711 <li class=
"tsd-signature tsd-anchor-link" id=
"setMaxListeners-2.setMaxListeners-3"><span class=
"tsd-kind-call-signature">set
<wbr/>Max
<wbr/>Listeners
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-kind-parameter">n
</span><span class=
"tsd-signature-symbol">?
</span>,
<span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">eventTargets
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span><a href=
"#setMaxListeners-2.setMaxListeners-3" aria-label=
"Permalink" class=
"tsd-anchor-icon"><svg class=
"icon icon-tabler icon-tabler-link" viewBox=
"0 0 24 24" stroke-width=
"2" stroke=
"currentColor" fill=
"none" stroke-linecap=
"round" stroke-linejoin=
"round"><use href=
"#icon-anchor-a"></use><use href=
"#icon-anchor-b"></use><use href=
"#icon-anchor-c"></use></svg></a></li>
712 <li class=
"tsd-description">
713 <div class=
"tsd-comment tsd-typography"><pre><code class=
"language-js"><span class=
"hl-4">const
</span><span class=
"hl-0"> {
</span><br/><span class=
"hl-0"> </span><span class=
"hl-5">setMaxListeners
</span><span class=
"hl-0">,
</span><br/><span class=
"hl-0"> </span><span class=
"hl-5">EventEmitter
</span><br/><span class=
"hl-0">} =
</span><span class=
"hl-2">require
</span><span class=
"hl-0">(
</span><span class=
"hl-6">'events
'</span><span class=
"hl-0">);
</span><br/><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">target
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventTarget
</span><span class=
"hl-0">();
</span><br/><span class=
"hl-4">const
</span><span class=
"hl-0"> </span><span class=
"hl-5">emitter
</span><span class=
"hl-0"> =
</span><span class=
"hl-4">new
</span><span class=
"hl-0"> </span><span class=
"hl-2">EventEmitter
</span><span class=
"hl-0">();
</span><br/><br/><span class=
"hl-2">setMaxListeners
</span><span class=
"hl-0">(
</span><span class=
"hl-1">5</span><span class=
"hl-0">,
</span><span class=
"hl-3">target
</span><span class=
"hl-0">,
</span><span class=
"hl-3">emitter
</span><span class=
"hl-0">);
</span>
714 </code><button>Copy
</button></pre>
716 <h3>Since
</h3><p>v15.4
.0</p>
718 <div class=
"tsd-parameters">
719 <h4 class=
"tsd-parameters-title">Parameters
</h4>
720 <ul class=
"tsd-parameter-list">
722 <h5><code class=
"tsd-tag ts-flagOptional">Optional
</code> <span class=
"tsd-kind-parameter">n
</span>:
<span class=
"tsd-signature-type">number
</span></h5>
723 <div class=
"tsd-comment tsd-typography"><p>A non-negative number. The maximum number of listeners per
<code>EventTarget
</code> event.
</p>
726 <h5><code class=
"tsd-tag ts-flagRest">Rest
</code> <span class=
"tsd-signature-symbol">...
</span><span class=
"tsd-kind-parameter">eventTargets
</span>:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-type ">EventEmitter
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type ">_DOMEventTarget
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">[]
</span></h5></li></ul></div>
727 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4><aside class=
"tsd-sources">
728 <p>Inherited from EventEmitter.setMaxListeners
</p>
730 <li>Defined in node_modules/.pnpm/@types+node@
18.16.3/node_modules/@types/node/events.d.ts:
317</li></ul></aside></li></ul></section></section></div>
731 <div class=
"col-sidebar">
732 <div class=
"page-menu">
733 <div class=
"tsd-navigation settings">
734 <details class=
"tsd-index-accordion"><summary class=
"tsd-accordion-summary">
735 <h3><svg width=
"20" height=
"20" viewBox=
"0 0 24 24" fill=
"none"><path d=
"M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill=
"var(--color-text)"></path></svg>Settings
</h3></summary>
736 <div class=
"tsd-accordion-details">
737 <div class=
"tsd-filter-visibility">
738 <h4 class=
"uppercase">Member Visibility
</h4><form>
739 <ul id=
"tsd-filter-options">
740 <li class=
"tsd-filter-item"><label class=
"tsd-filter-input"><input type=
"checkbox" id=
"tsd-filter-protected" name=
"protected"/><svg width=
"32" height=
"32" viewBox=
"0 0 32 32" aria-hidden=
"true"><rect class=
"tsd-checkbox-background" width=
"30" height=
"30" x=
"1" y=
"1" rx=
"6" fill=
"none"></rect><path class=
"tsd-checkbox-checkmark" d=
"M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke=
"none" stroke-width=
"3.5" stroke-linejoin=
"round" fill=
"none"></path></svg><span>Protected
</span></label></li>
741 <li class=
"tsd-filter-item"><label class=
"tsd-filter-input"><input type=
"checkbox" id=
"tsd-filter-private" name=
"private"/><svg width=
"32" height=
"32" viewBox=
"0 0 32 32" aria-hidden=
"true"><rect class=
"tsd-checkbox-background" width=
"30" height=
"30" x=
"1" y=
"1" rx=
"6" fill=
"none"></rect><path class=
"tsd-checkbox-checkmark" d=
"M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke=
"none" stroke-width=
"3.5" stroke-linejoin=
"round" fill=
"none"></path></svg><span>Private
</span></label></li>
742 <li class=
"tsd-filter-item"><label class=
"tsd-filter-input"><input type=
"checkbox" id=
"tsd-filter-inherited" name=
"inherited" checked
/><svg width=
"32" height=
"32" viewBox=
"0 0 32 32" aria-hidden=
"true"><rect class=
"tsd-checkbox-background" width=
"30" height=
"30" x=
"1" y=
"1" rx=
"6" fill=
"none"></rect><path class=
"tsd-checkbox-checkmark" d=
"M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke=
"none" stroke-width=
"3.5" stroke-linejoin=
"round" fill=
"none"></path></svg><span>Inherited
</span></label></li>
743 <li class=
"tsd-filter-item"><label class=
"tsd-filter-input"><input type=
"checkbox" id=
"tsd-filter-external" name=
"external"/><svg width=
"32" height=
"32" viewBox=
"0 0 32 32" aria-hidden=
"true"><rect class=
"tsd-checkbox-background" width=
"30" height=
"30" x=
"1" y=
"1" rx=
"6" fill=
"none"></rect><path class=
"tsd-checkbox-checkmark" d=
"M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke=
"none" stroke-width=
"3.5" stroke-linejoin=
"round" fill=
"none"></path></svg><span>External
</span></label></li></ul></form></div>
744 <div class=
"tsd-theme-toggle">
745 <h4 class=
"uppercase">Theme
</h4><select id=
"tsd-theme"><option value=
"os">OS
</option><option value=
"light">Light
</option><option value=
"dark">Dark
</option></select></div></div></details></div>
746 <details open
class=
"tsd-index-accordion tsd-page-navigation"><summary class=
"tsd-accordion-summary">
747 <h3><svg width=
"20" height=
"20" viewBox=
"0 0 24 24" fill=
"none"><path d=
"M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill=
"var(--color-text)"></path></svg>On This Page
</h3></summary>
748 <div class=
"tsd-accordion-details">
750 <li><a href=
"#constructor" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-512-path"></use><use href=
"#icon-512-text"></use></svg><span>constructor
</span></a></li>
751 <li><a href=
"#captureRejectionSymbol" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>capture
<wbr/>Rejection
<wbr/>Symbol
</span></a></li>
752 <li><a href=
"#captureRejections" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>capture
<wbr/>Rejections
</span></a></li>
753 <li><a href=
"#defaultMaxListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>default
<wbr/>Max
<wbr/>Listeners
</span></a></li>
754 <li><a href=
"#errorMonitor" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-1024-path"></use><use href=
"#icon-1024-text"></use></svg><span>error
<wbr/>Monitor
</span></a></li>
755 <li><a href=
"#addListener" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>add
<wbr/>Listener
</span></a></li>
756 <li><a href=
"#emit" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>emit
</span></a></li>
757 <li><a href=
"#eventNames" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>event
<wbr/>Names
</span></a></li>
758 <li><a href=
"#getMaxListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>get
<wbr/>Max
<wbr/>Listeners
</span></a></li>
759 <li><a href=
"#listenerCount" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listener
<wbr/>Count
</span></a></li>
760 <li><a href=
"#listeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listeners
</span></a></li>
761 <li><a href=
"#off" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>off
</span></a></li>
762 <li><a href=
"#on" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>on
</span></a></li>
763 <li><a href=
"#once" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>once
</span></a></li>
764 <li><a href=
"#prependListener" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>prepend
<wbr/>Listener
</span></a></li>
765 <li><a href=
"#prependOnceListener" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>prepend
<wbr/>Once
<wbr/>Listener
</span></a></li>
766 <li><a href=
"#rawListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>raw
<wbr/>Listeners
</span></a></li>
767 <li><a href=
"#removeAllListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>remove
<wbr/>All
<wbr/>Listeners
</span></a></li>
768 <li><a href=
"#removeListener" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>remove
<wbr/>Listener
</span></a></li>
769 <li><a href=
"#setMaxListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>set
<wbr/>Max
<wbr/>Listeners
</span></a></li>
770 <li><a href=
"#getEventListeners" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>get
<wbr/>Event
<wbr/>Listeners
</span></a></li>
771 <li><a href=
"#listenerCount-2" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>listener
<wbr/>Count
</span></a></li>
772 <li><a href=
"#on-2" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>on
</span></a></li>
773 <li><a href=
"#once-2" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>once
</span></a></li>
774 <li><a href=
"#setMaxListeners-2" class=
"tsd-is-inherited tsd-is-external"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-2048-path"></use><use href=
"#icon-2048-text"></use></svg><span>set
<wbr/>Max
<wbr/>Listeners
</span></a></li></ul></div></details></div>
775 <div class=
"site-menu">
776 <nav class=
"tsd-navigation"><a href=
"../index.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-namespace)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-4-path"></rect><path d=
"M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill=
"var(--color-text)" id=
"icon-4-text"></path></svg><span>poolifier
</span></a>
777 <ul class=
"tsd-small-nested-navigation">
778 <li><a href=
"../enums/PoolType.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-enum)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-8-path"></rect><path d=
"M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill=
"var(--color-text)" id=
"icon-8-text"></path></svg><span>Pool
<wbr/>Type
</span></a></li>
779 <li><a href=
"AbstractPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-class)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-128-path"></rect><path d=
"M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill=
"var(--color-text)" id=
"icon-128-text"></path></svg><span>Abstract
<wbr/>Pool
</span></a></li>
780 <li><a href=
"AbstractWorker.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Abstract
<wbr/>Worker
</span></a></li>
781 <li><a href=
"CircularArray.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Circular
<wbr/>Array
</span></a></li>
782 <li><a href=
"ClusterWorker.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Cluster
<wbr/>Worker
</span></a></li>
783 <li><a href=
"DynamicClusterPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Dynamic
<wbr/>Cluster
<wbr/>Pool
</span></a></li>
784 <li><a href=
"DynamicThreadPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Dynamic
<wbr/>Thread
<wbr/>Pool
</span></a></li>
785 <li><a href=
"FixedClusterPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Fixed
<wbr/>Cluster
<wbr/>Pool
</span></a></li>
786 <li><a href=
"FixedThreadPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Fixed
<wbr/>Thread
<wbr/>Pool
</span></a></li>
787 <li><a href=
"PoolEmitter.html" class=
"current"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Pool
<wbr/>Emitter
</span></a></li>
788 <li><a href=
"Queue.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Queue
</span></a></li>
789 <li><a href=
"ThreadWorker.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Thread
<wbr/>Worker
</span></a></li>
790 <li><a href=
"WorkerChoiceStrategyContext.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-128-path"></use><use href=
"#icon-128-text"></use></svg><span>Worker
<wbr/>Choice
<wbr/>Strategy
<wbr/>Context
</span></a></li>
791 <li><a href=
"../interfaces/ClusterPoolOptions.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-interface)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-256-path"></rect><path d=
"M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill=
"var(--color-text)" id=
"icon-256-text"></path></svg><span>Cluster
<wbr/>Pool
<wbr/>Options
</span></a></li>
792 <li><a href=
"../interfaces/IPool.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>IPool
</span></a></li>
793 <li><a href=
"../interfaces/IWorker.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>IWorker
</span></a></li>
794 <li><a href=
"../interfaces/IWorkerChoiceStrategy.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>IWorker
<wbr/>Choice
<wbr/>Strategy
</span></a></li>
795 <li><a href=
"../interfaces/MessageValue.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Message
<wbr/>Value
</span></a></li>
796 <li><a href=
"../interfaces/PoolOptions.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Pool
<wbr/>Options
</span></a></li>
797 <li><a href=
"../interfaces/PromiseResponseWrapper.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Promise
<wbr/>Response
<wbr/>Wrapper
</span></a></li>
798 <li><a href=
"../interfaces/RequiredStatistics.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Required
<wbr/>Statistics
</span></a></li>
799 <li><a href=
"../interfaces/Task.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Task
</span></a></li>
800 <li><a href=
"../interfaces/TasksQueueOptions.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Tasks
<wbr/>Queue
<wbr/>Options
</span></a></li>
801 <li><a href=
"../interfaces/TasksUsage.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Tasks
<wbr/>Usage
</span></a></li>
802 <li><a href=
"../interfaces/WorkerChoiceStrategyOptions.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Worker
<wbr/>Choice
<wbr/>Strategy
<wbr/>Options
</span></a></li>
803 <li><a href=
"../interfaces/WorkerNode.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Worker
<wbr/>Node
</span></a></li>
804 <li><a href=
"../interfaces/WorkerOptions.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-256-path"></use><use href=
"#icon-256-text"></use></svg><span>Worker
<wbr/>Options
</span></a></li>
805 <li><a href=
"../types/Draft.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-type-alias)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-4194304-path"></rect><path d=
"M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill=
"var(--color-text)" id=
"icon-4194304-text"></path></svg><span>Draft
</span></a></li>
806 <li><a href=
"../types/ErrorHandler.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Error
<wbr/>Handler
</span></a></li>
807 <li><a href=
"../types/ExitHandler.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Exit
<wbr/>Handler
</span></a></li>
808 <li><a href=
"../types/KillBehavior.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Kill
<wbr/>Behavior
</span></a></li>
809 <li><a href=
"../types/MessageHandler.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Message
<wbr/>Handler
</span></a></li>
810 <li><a href=
"../types/OnlineHandler.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Online
<wbr/>Handler
</span></a></li>
811 <li><a href=
"../types/PoolEvent.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Pool
<wbr/>Event
</span></a></li>
812 <li><a href=
"../types/ThreadWorkerWithMessageChannel.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Thread
<wbr/>Worker
<wbr/>With
<wbr/>Message
<wbr/>Channel
</span></a></li>
813 <li><a href=
"../types/WorkerAsyncFunction.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Worker
<wbr/>Async
<wbr/>Function
</span></a></li>
814 <li><a href=
"../types/WorkerChoiceStrategy.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Worker
<wbr/>Choice
<wbr/>Strategy
</span></a></li>
815 <li><a href=
"../types/WorkerFunction.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Worker
<wbr/>Function
</span></a></li>
816 <li><a href=
"../types/WorkerSyncFunction.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-4194304-path"></use><use href=
"#icon-4194304-text"></use></svg><span>Worker
<wbr/>Sync
<wbr/>Function
</span></a></li>
817 <li><a href=
"../variables/KillBehaviors.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><rect fill=
"var(--color-icon-background)" stroke=
"var(--color-ts-variable)" stroke-width=
"1.5" x=
"1" y=
"1" width=
"22" height=
"22" rx=
"6" id=
"icon-32-path"></rect><path d=
"M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill=
"var(--color-text)" id=
"icon-32-text"></path></svg><span>Kill
<wbr/>Behaviors
</span></a></li>
818 <li><a href=
"../variables/PoolEvents.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-32-path"></use><use href=
"#icon-32-text"></use></svg><span>Pool
<wbr/>Events
</span></a></li>
819 <li><a href=
"../variables/WorkerChoiceStrategies.html"><svg class=
"tsd-kind-icon" width=
"24" height=
"24" viewBox=
"0 0 24 24"><use href=
"#icon-32-path"></use><use href=
"#icon-32-text"></use></svg><span>Worker
<wbr/>Choice
<wbr/>Strategies
</span></a></li></ul></nav></div></div></div>
820 <div class=
"tsd-generator">
821 <p>Generated using
<a href=
"https://typedoc.org/" target=
"_blank">TypeDoc
</a></p></div>
822 <div class=
"overlay"></div></body></html>