</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.captureRejectionSymbol</p><ul><li>Defined in node_modules/@types/node/events.d.ts:452</li></ul></aside></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="defaultMaxListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>default<wbr/>Max<wbr/>Listeners</span><ahref="#defaultMaxListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><divclass="tsd-signature"><spanclass="tsd-kind-property">default<wbr/>Max<wbr/>Listeners</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">number</span></div><divclass="tsd-comment tsd-typography"><p>By default, a maximum of <code>10</code> listeners can be registered for any single
event. This limit can be changed for individual <code>EventEmitter</code> instances
using the <code>emitter.setMaxListeners(n)</code> method. To change the default
for <em>all</em><code>EventEmitter</code> instances, the <code>events.defaultMaxListeners</code> property
can be used. If this value is not a positive number, a <code>RangeError</code> is thrown.</p>
<p>Take caution when setting the <code>events.defaultMaxListeners</code> because the
change affects <em>all</em><code>EventEmitter</code> instances, including those created before
the change is made. However, calling <code>emitter.setMaxListeners(n)</code> still has
precedence over <code>events.defaultMaxListeners</code>.</p>
<p>This is not a hard limit. The <code>EventEmitter</code> instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
<code>EventEmitter</code>, the <code>emitter.getMaxListeners()</code> and <code>emitter.setMaxListeners()</code> methods can be used to
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.defaultMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:498</li></ul></aside></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="errorMonitor"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><codeclass="tsd-tag">Readonly</code><span>error<wbr/>Monitor</span><ahref="#errorMonitor"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><divclass="tsd-signature"><spanclass="tsd-kind-property">error<wbr/>Monitor</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-keyword">typeof </span><ahref="GPIOAccess.html#errorMonitor"class="tsd-signature-type tsd-kind-property">errorMonitor</a></div><divclass="tsd-comment tsd-typography"><p>This symbol shall be used to install a listener for only monitoring <code>'error'</code> events. Listeners installed using this symbol are called before the regular <code>'error'</code> listeners are called.</p>
<p>Installing a listener using this symbol does not change the behavior once an <code>'error'</code> event is emitted. Therefore, the process will still crash if no
regular <code>'error'</code> listener is installed.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.addListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:597</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="emit"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>emit</span><ahref="#emit"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="emit.emit-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">emit</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#emit.emit-1.K-2">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-signature-symbol">...</span><spanclass="tsd-kind-parameter">args</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">boolean</span><ahref="#emit.emit-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="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
<p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
<pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">myEmitter</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">EventEmitter</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-8">// First listener</span><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-0">function</span><spanclass="hl-1"></span><spanclass="hl-3">firstListener</span><spanclass="hl-1">() {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'Helloooo! first listener'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span><br/><spanclass="hl-8">// Second listener</span><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-0">function</span><spanclass="hl-1"></span><spanclass="hl-3">secondListener</span><spanclass="hl-1">(</span><spanclass="hl-5">arg1</span><spanclass="hl-1">, </span><spanclass="hl-5">arg2</span><spanclass="hl-1">) {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">`event with parameters </span><spanclass="hl-0">${</span><spanclass="hl-5">arg1</span><spanclass="hl-0">}</span><spanclass="hl-4">, </span><spanclass="hl-0">${</span><spanclass="hl-5">arg2</span><spanclass="hl-0">}</span><spanclass="hl-4"> in second listener`</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span><br/><spanclass="hl-8">// Third listener</span><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-0">function</span><spanclass="hl-1"></span><spanclass="hl-3">thirdListener</span><spanclass="hl-1">(...</span><spanclass="hl-5">args</span><spanclass="hl-1">) {</span><br/><spanclass="hl-1"></span><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">parameters</span><spanclass="hl-1"> = </span><spanclass="hl-5">args</span><spanclass="hl-1">.</span><spanclass="hl-3">join</span><spanclass="hl-1">(</span><spanclass="hl-4">', '</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">`event with parameters </span><spanclass="hl-0">${</span><spanclass="hl-5">parameters</span><spanclass="hl-0">}</span><spanclass="hl-4"> in third listener`</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span><br/><br/><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">listeners</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">));</span><br/><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-7">1</span><spanclass="hl-1">, </span><spanclass="hl-7">2</span><spanclass="hl-1">, </span><spanclass="hl-7">3</span><spanclass="hl-1">, </span><spanclass="hl-7">4</span><spanclass="hl-1">, </span><spanclass="hl-7">5</span><span
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.emit</p><ul><li>Defined in node_modules/@types/node/events.d.ts:859</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="eventNames"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>event<wbr/>Names</span><ahref="#eventNames"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="eventNames.eventNames-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">event<wbr/>Names</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">[]</span><ahref="#eventNames.eventNames-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns an array listing the events for which the emitter has registered
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.eventNames</p><ul><li>Defined in node_modules/@types/node/events.d.ts:922</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="getMaxListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Max<wbr/>Listeners</span><ahref="#getMaxListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="getMaxListeners.getMaxListeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Max<wbr/>Listeners</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">number</span><ahref="#getMaxListeners.getMaxListeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns the current max listener value for the <code>EventEmitter</code> which is either
set by <code>emitter.setMaxListeners(n)</code> or defaults to <ahref="GPIOAccess.html#defaultMaxListeners"class="tsd-kind-property">defaultMaxListeners</a>.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:774</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="listenerCount"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>listener<wbr/>Count</span><ahref="#listenerCount"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="listenerCount.listenerCount-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">listener<wbr/>Count</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#listenerCount.listenerCount-1.K-3">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">number</span><ahref="#listenerCount.listenerCount-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns the number of listeners listening for the event named <code>eventName</code>.
If <code>listener</code> is provided, it will return how many times the listener is found
in the list of the listeners of the event.</p>
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><span><aid="listenerCount.listenerCount-1.K-3"class="tsd-anchor"></a><spanclass="tsd-kind-type-parameter">K</span></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span><divclass="tsd-comment tsd-typography"><p>The name of the event being listened for</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/@types/node/events.d.ts:868</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="listeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>listeners</span><ahref="#listeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="listeners.listeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">listeners</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#listeners.listeners-1.K-4">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">Function</span><spanclass="tsd-signature-symbol">[]</span><ahref="#listeners.listeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.off</p><ul><li>Defined in node_modules/@types/node/events.d.ts:747</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="on"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>on</span><ahref="#on"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="on.on-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">on</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#on.on-1.K-6">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#on.on-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Adds the <code>listener</code> function to the end of the listeners array for the event
named <code>eventName</code>. No checks are made to see if the <code>listener</code> has 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 times.</p>
<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
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><span><aid="on.on-1.K-6"class="tsd-anchor"></a><spanclass="tsd-kind-type-parameter">K</span></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span><divclass="tsd-comment tsd-typography"><p>The name of the event.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/@types/node/events.d.ts:629</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="once"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>once</span><ahref="#once"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="once.once-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">once</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#once.once-1.K-7">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#once.once-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Adds a <strong>one-time</strong><code>listener</code> function for the event named <code>eventName</code>. The
<pre><codeclass="js"><spanclass="hl-5">server</span><spanclass="hl-1">.</span><spanclass="hl-3">once</span><spanclass="hl-1">(</span><spanclass="hl-4">'connection'</span><spanclass="hl-1">, (</span><spanclass="hl-5">stream</span><spanclass="hl-1">) </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'Ah, we have our first user!'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span>
<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
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><span><aid="once.once-1.K-7"class="tsd-anchor"></a><spanclass="tsd-kind-type-parameter">K</span></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span><divclass="tsd-comment tsd-typography"><p>The name of the event.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/@types/node/events.d.ts:659</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="prependListener"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>prepend<wbr/>Listener</span><ahref="#prependListener"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="prependListener.prependListener-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">prepend<wbr/>Listener</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#prependListener.prependListener-1.K-8">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#prependListener.prependListener-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Adds the <code>listener</code> function to the <em>beginning</em> of the listeners array for the
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><span><aid="prependListener.prependListener-1.K-8"class="tsd-anchor"></a><spanclass="tsd-kind-type-parameter">K</span></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span><divclass="tsd-comment tsd-typography"><p>The name of the event.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.prependListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:886</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="prependOnceListener"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>prepend<wbr/>Once<wbr/>Listener</span><ahref="#prependOnceListener"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="prependOnceListener.prependOnceListener-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#prependOnceListener.prependOnceListener-1.K-9">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#prependOnceListener.prependOnceListener-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="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
<pre><codeclass="js"><spanclass="hl-5">server</span><spanclass="hl-1">.</span><spanclass="hl-3">prependOnceListener</span><spanclass="hl-1">(</span><spanclass="hl-4">'connection'</span><spanclass="hl-1">, (</span><spanclass="hl-5">stream</span><spanclass="hl-1">) </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'Ah, we have our first user!'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span>
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><span><aid="prependOnceListener.prependOnceListener-1.K-9"class="tsd-anchor"></a><spanclass="tsd-kind-type-parameter">K</span></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span><divclass="tsd-comment tsd-typography"><p>The name of the event.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.prependOnceListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:902</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="rawListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>raw<wbr/>Listeners</span><ahref="#rawListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="rawListeners.rawListeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">raw<wbr/>Listeners</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#rawListeners.rawListeners-1.K-10">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">Function</span><spanclass="tsd-signature-symbol">[]</span><ahref="#rawListeners.rawListeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>,
<pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">emitter</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">EventEmitter</span><spanclass="hl-1">();</span><br/><spanclass="hl-5">emitter</span><spanclass="hl-1">.</span><spanclass="hl-3">once</span><spanclass="hl-1">(</span><spanclass="hl-4">'log'</span><spanclass="hl-1">, () </span><spanclass="hl-0">=></span><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'log once'</span><spanclass="hl-1">));</span><br/><br/><spanclass="hl-8">// Returns a new Array with a function `onceWrapper` which has a property</span><br/><spanclass="hl-8">// `listener` which contains the original listener bound above</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">listeners</span><spanclass="hl-1"> = </span><spanclass="hl-5">emitter</span><spanclass="hl-1">.</span><spanclass="hl-3">rawListeners</span><spanclass="hl-1">(</span><spanclass="hl-4">'log'</span><spanclass="hl-1">);</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">logFnWrapper</span><spanclass="hl-1"> = </span><spanclass="hl-5">listeners</span><spanclass="hl-1">[</span><spanclass="hl-7">0</span><spanclass="hl-1">];</span><br/><br/><spanclass="hl-8">// Logs "log once" to the console and does not unbind the `once` event</span><br/><spanclass="hl-5">logFnWrapper</span><spanclass="hl-1">.</span><spanclass="hl-3">listener</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-8">// Logs "log once" to the console and removes the listener</span><br/><spanclass="hl-3">logFnWrapper</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-5">emitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'log'</span><spanclass="hl-1">, () </span><spanclass="hl-0">=></span><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'log persistently'</span><spanclass="hl-1">));</span><br/><spanclass="hl-8">// Will return a new Array with a single function bound by `.on()` above</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">newListeners</span><spanclass="hl-1"> = </span><spanclass="hl-5">emitter</span><spanclass="hl-1">.</span><spanclass="hl-3">rawListeners</span><spanclass="hl-1">(</span><spanclass="hl-4">'log'</span><spanclass="hl-1">);</span><br/><br/><spanclass="hl-8">// Logs "log persistently" twice</span><br/><spanclass="hl-5">newListeners</span><spanclass="hl-1">[</span><spanclass="hl-7">0</span><spanclass="hl-1">]();</span><br/><spanclass="hl-5">emitter</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'log'</span><spanclass="hl-1">);</span>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.rawListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:818</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="removeAllListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>remove<wbr/>All<wbr/>Listeners</span><ahref="#removeAllListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="removeAllListeners.removeAllListeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">remove<wbr/>All<wbr/>Listeners</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#removeAllListeners.removeAllListeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Removes all listeners, or those of the specified <code>eventName</code>.</p>
<p>It is bad practice to remove listeners added elsewhere in the code,
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.removeAllListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:758</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="removeListener"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>remove<wbr/>Listener</span><ahref="#removeListener"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="removeListener.removeListener-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">remove<wbr/>Listener</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="GPIOAccess.html#removeListener.removeListener-1.K-11">K</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#removeListener.removeListener-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Removes the specified <code>listener</code> from the listener array for the event named <code>eventName</code>.</p>
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
will not remove them from<code>emit()</code> in progress. Subsequent events behave as expected.</p>
<pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-0">class</span><spanclass="hl-1"></span><spanclass="hl-9">MyEmitter</span><spanclass="hl-1"></span><spanclass="hl-0">extends</span><spanclass="hl-1"></span><spanclass="hl-9">EventEmitter</span><spanclass="hl-1"> {}</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">myEmitter</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">MyEmitter</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-3">callbackA</span><spanclass="hl-1"> = () </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'A'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">removeListener</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-5">callbackB</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">};</span><br/><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-3">callbackB</span><spanclass="hl-1"> = () </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'B'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">};</span><br/><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-5">callbackA</span><spanclass="hl-1">);</span><br/><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">, </span><spanclass="hl-5">callbackB</span><spanclass="hl-1">);</span><br/><br/><spanclass="hl-8">// callbackA removes listener callbackB but it will still be called.</span><br/><spanclass="hl-8">// Internal listener array at time of emit [callbackA, callbackB]</span><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">);</span><br/><spanclass="hl-8">// Prints:</span><br/><spanclass="hl-8">// A</span><br/><spanclass="hl-8">// B</span><br/><br/><spanclass="hl-8">// callbackB is now removed.</span><br/><spanclass="hl-8">// Internal listener array [callbackA]</span><br/><spanclass="hl-5">myEmitter</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'event'</span><spanclass="hl-1">);</span><br/><spanclass="hl-8">// Prints:</span><br/><spanclass="hl-8">// A</span>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.removeListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:742</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="setMaxListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>set<wbr/>Max<wbr/>Listeners</span><ahref="#setMaxListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="setMaxListeners.setMaxListeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">set<wbr/>Max<wbr/>Listeners</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">n</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">this</span><ahref="#setMaxListeners.setMaxListeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>By default <code>EventEmitter</code>s will print a warning if more than <code>10</code> listeners are
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>
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/chirimen-oh/node-web-gpio/blob/cd50093ae2cf0e031ddcb907d12da5122d1b7fa2/index.ts#L122">index.ts:122</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="addAbortListener"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>add<wbr/>Abort<wbr/>Listener</span><ahref="#addAbortListener"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="addAbortListener.addAbortListener-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">add<wbr/>Abort<wbr/>Listener</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">signal</span>, <spanclass="tsd-kind-parameter">resource</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">Disposable</span><ahref="#addAbortListener.addAbortListener-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><codeclass="tsd-tag">Experimental</code><divclass="tsd-comment tsd-typography"><p>Listens once to the <code>abort</code> event on the provided <code>signal</code>.</p>
<p>Listening to the <code>abort</code> event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.addAbortListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:437</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="getEventListeners"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>get<wbr/>Event<wbr/>Listeners</span><ahref="#getEventListeners"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="getEventListeners.getEventListeners-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Event<wbr/>Listeners</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span>, <spanclass="tsd-kind-parameter">name</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">Function</span><spanclass="tsd-signature-symbol">[]</span><ahref="#getEventListeners.getEventListeners-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>.</p>
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.listeners</code> on
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.getEventListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:358</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="getMaxListeners-2"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>get<wbr/>Max<wbr/>Listeners</span><ahref="#getMaxListeners-2"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="getMaxListeners-2.getMaxListeners-3"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Max<wbr/>Listeners</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">number</span><ahref="#getMaxListeners-2.getMaxListeners-3"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Returns the currently set max amount of listeners.</p>
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.getMaxListeners</code> on
the emitter.</p>
<p>For <code>EventTarget</code>s this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:387</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="listenerCount-2"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><spanclass="deprecated">listener<wbr/>Count</span><ahref="#listenerCount-2"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="listenerCount-2.listenerCount-3"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">listener<wbr/>Count</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span>, <spanclass="tsd-kind-parameter">eventName</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">number</span><ahref="#listenerCount-2.listenerCount-3"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="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>
<h4class="tsd-anchor-link"><aid="Deprecated"class="tsd-anchor"></a>Deprecated<ahref="#Deprecated"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Since v3.2.0 - Use <code>listenerCount</code> instead.</p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/@types/node/events.d.ts:330</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="on-2"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>on</span><ahref="#on-2"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="on-2.on-3"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">on</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span>, <spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">options</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">AsyncIterableIterator</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">></span><ahref="#on-2.on-3"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">on</span><spanclass="hl-1">, </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-6">import</span><spanclass="hl-1"></span><spanclass="hl-5">process</span><spanclass="hl-1"></span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:process'</span><spanclass="hl-1">;</span><br/><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">ee</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">EventEmitter</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-8">// Emit later on</span><br/><spanclass="hl-5">process</span><spanclass="hl-1">.</span><spanclass="hl-3">nextTick</span><spanclass="hl-1">(() </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-4">'bar'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-7">42</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span><br/><br/><spanclass="hl-6">for</span><spanclass="hl-1"></span><spanclass="hl-6">await</span><spanclass="hl-1"> (</span><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">event</span><spanclass="hl-1"></span><spanclass="hl-0">of</span><spanclass="hl-1"></span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-5">ee</span><spanclass="hl-1">, </span><spanclass="hl-4">'foo'</span><spanclass="hl-1">)) {</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// The execution of this inner block is synchronous and it</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// processes one event at a time (even with await). Do not use</span><br/><spanclass="hl-1"></span><spanclass="hl-8">/
</code><buttontype="button">Copy</button></pre>
<p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
exiting the loop. The <code>value</code> returned by each iteration is an array
composed of the emitted event arguments.</p>
<p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
<pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">on</span><spanclass="hl-1">, </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-6">import</span><spanclass="hl-1"></span><spanclass="hl-5">process</span><spanclass="hl-1"></span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:process'</span><spanclass="hl-1">;</span><br/><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">ac</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">AbortController</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-1">(</span><spanclass="hl-0">async</span><spanclass="hl-1"> () </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">ee</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">EventEmitter</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-1"></span><spanclass="hl-8">// Emit later on</span><br/><spanclass="hl-1"></span><spanclass="hl-5">process</span><spanclass="hl-1">.</span><spanclass="hl-3">nextTick</span><spanclass="hl-1">(() </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-4">'bar'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-7">42</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"> });</span><br/><br/><spanclass="hl-1"></span><spanclass="hl-6">for</span><spanclass="hl-1"></span><spanclass="hl-6">await</span><spanclass="hl-1"> (</span><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">event</span><spanclass="hl-1"></span><spanclass="hl-0">of</span><spanclass="hl-1"></span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-5">ee</span><spanclass="hl-1">, </span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, { </span><spanclass="hl-5">signal:</span><spanclass="hl-1"></span><spanclass="hl-5">ac</span><spanclass="hl-1">.</span><spanclass="hl-5">signal</span><spanclass="hl-1"> })) {</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// The execution of this inner block is synchronous and it</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// processes one event at a time (even with await). Do not use</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// if concurrent execution is required.</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-5">event</span><spanclass="hl-1">); </span><spanclass="hl-8">// prints ['bar'] [42]</span><br/><spanclass="hl-1"> }</span><br/><spanclass="hl-1"></span><spanclass="hl-8">// Unreachable here</span><br/><spanclass="hl-1">})();</span><br/><br/><spanclass="hl-5">process</span><spanclass="hl-1">.</span><spanclass="hl-3">nextTick</span><spanclass="hl-1">(() </span><spanclass="hl-0">=></span><spanclass="hl-1"></span><spanclass="hl-5">ac</span><spanclass="hl-1">.</span><spanclass="hl-3">abort</span><spanclass="hl-1">());</span>
</code><buttontype="button">Copy</button></pre>
<p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
<pre><codeclass="js"><spanclass="hl-6">import</span><spanclass="hl-1"> { </span><spanclass="hl-5">on</span><spanclass="hl-1">, </span><spanclass="hl-5">EventEmitter</span><spanclass="hl-1"> } </span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:events'</span><spanclass="hl-1">;</span><br/><spanclass="hl-6">import</span><spanclass="hl-1"></span><spanclass="hl-5">process</span><spanclass="hl-1"></span><spanclass="hl-6">from</span><spanclass="hl-1"></span><spanclass="hl-4">'node:process'</span><spanclass="hl-1">;</span><br/><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">ee</span><spanclass="hl-1"> = </span><spanclass="hl-0">new</span><spanclass="hl-1"></span><spanclass="hl-3">EventEmitter</span><spanclass="hl-1">();</span><br/><br/><spanclass="hl-8">// Emit later on</span><br/><spanclass="hl-5">process</span><spanclass="hl-1">.</span><spanclass="hl-3">nextTick</span><spanclass="hl-1">(() </span><spanclass="hl-0">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-4">'bar'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, </span><spanclass="hl-7">42</span><spanclass="hl-1">);</span><br/><spanclass="hl-1"></span><spanclass="hl-5">ee</span><spanclass="hl-1">.</span><spanclass="hl-3">emit</span><spanclass="hl-1">(</span><spanclass="hl-4">'close'</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">});</span><br/><br/><spanclass="hl-6">for</span><spanclass="hl-1"></span><spanclass="hl-6">await</span><spanclass="hl-1"> (</span><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">event</span><spanclass="hl-1"></span><spanclass="hl-0">of</span><spanclass="hl-1"></span><spanclass="hl-3">on</span><spanclass="hl-1">(</span><spanclass="hl-5">ee</span><spanclass="hl-1">, </span><spanclass="hl-4">'foo'</span><spanclass="hl-1">, { </span><spanclass="hl-5">close:</span><spanclass="hl-1"> [</span><spanclass="hl-4">'close'</span><spanclass="hl-1">] })) {</span><br/><spanclass="hl-1"></span><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-5">event</span><spanclass="hl-1">); </span><spanclass="hl-8">// prints ['bar'] [42]</span><br/><spanclass="hl-1">}</span><br/><spanclass="hl-8">// the loop will exit after 'close' is emitted</span><br/><spanclass="hl-5">console</span><spanclass="hl-1">.</span><spanclass="hl-3">log</span><spanclass="hl-1">(</span><spanclass="hl-4">'done'</span><spanclass="hl-1">); </span><spanclass="hl-8">// prints 'done'</span>
</code><buttontype="button">Copy</button></pre>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">emitter</span>: <spanclass="tsd-signature-type">EventEmitter</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">DefaultEventMap</span><spanclass="tsd-signature-symbol">></span></span></li><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">symbol</span></span></li><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">options</span>: <spanclass="tsd-signature-type">StaticEventEmitterIteratorOptions</span></span></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">AsyncIterableIterator</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">></span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
</div><asideclass="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/@types/node/events.d.ts:303</li></ul></aside></li><liclass="tsd-signature tsd-anchor-link"><aid="on-2.on-4"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">on</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span>, <spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">options</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">AsyncIterableIterator</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">></span><ahref="#on-2.on-4"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">emitter</span>: <spanclass="tsd-signature-type">EventTarget</span></span></li><li><span><spanclass="tsd-kind-parameter">eventName</span>: <spanclass="tsd-signature-type">string</span></span></li><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">options</span>: <spanclass="tsd-signature-type">StaticEventEmitterIteratorOptions</span></span></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">AsyncIterableIterator</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">, </span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">></span></h4><asideclass="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/@types/node/events.d.ts:308</li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><aid="once-2"class="tsd-anchor"></a><h3class="tsd-anchor-link"><codeclass="tsd-tag">Static</code><span>once</span><ahref="#once-2"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-signature tsd-anchor-link"><aid="once-2.once-3"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">once</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">emitter</span>, <spanclass="tsd-kind-parameter">eventName</span>, <spanclass="tsd-kind-parameter">options</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">any</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">></span><ahref="#once-2.once-3"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Creates a <code>Promise</code> that is fulfilled when the <code>EventEmitter</code> emits the given
event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
<p>This method is intentionally generic and works with the web platform <ahref="https://dom.spec.whatwg.org/#interface-eventtarget"target="_blank"class="external">EventTarget</a> interface, which has no special<code>'error'</code> event
semantics and does not listen to the <code>'error'</code> event.</p>
<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
'<code>error'</code> event itself, then it is treated as any other kind of event without
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">n</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p>