mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
144 lines
126 KiB
HTML
Vendored
144 lines
126 KiB
HTML
Vendored
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>EventEmitter | trilium</title><meta name="description" content="Documentation for trilium"/><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/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">trilium</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/Backend_Script_API.html">Backend Script API</a></li><li><a href="../modules/Backend_Script_API._internal_.html"><internal></a></li><li><a href="" aria-current="page">EventEmitter</a></li></ul><h1>Interface EventEmitter<T></h1></div><div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">EventEmitter</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a> <span class="tsd-signature-keyword">extends</span> <a href="../types/Backend_Script_API._internal_.EventMap.html" class="tsd-signature-type tsd-kind-type-alias">EventMap</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">=</span> <a href="../types/Backend_Script_API._internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">{</span><br/> <a class="tsd-kind-call-signature" href="#capturerejectionsymbol-1">"[captureRejectionSymbol]"</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <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><br/> <a class="tsd-kind-call-signature" href="#addlistener-1">addListener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#addlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#emit-1">emit</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#emitk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><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> <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#eventnames-1">eventNames</a><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> <a href="../types/Backend_Script_API._internal_.Key2.html" class="tsd-signature-type tsd-kind-type-alias">Key2</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span>)<span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#getmaxlisteners-1">getMaxListeners</a><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#listenercount-1">listenerCount</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenercountk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">?:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#listeners-1">listeners</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#off-1">off</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#offk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#on-1">on</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#onk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#once-1">once</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#oncek">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#prependlistener-1">prependListener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#prependoncelistener-1">prependOnceListener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependoncelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#rawlisteners-1">rawListeners</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#rawlistenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#removealllisteners-1">removeAllListeners</a><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">?:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#removelistener-1">removeListener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#removelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#setmaxlisteners-1">setMaxListeners</a><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">n</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="t"><span class="tsd-kind-type-parameter">T</span> <span class="tsd-signature-keyword">extends</span> <a href="../types/Backend_Script_API._internal_.EventMap.html" class="tsd-signature-type tsd-kind-type-alias">EventMap</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span> = <a href="../types/Backend_Script_API._internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a></span></li></ul></section><section class="tsd-panel tsd-hierarchy" data-refl="4835"><h4>Hierarchy (<a href="../hierarchy.html#Backend Script API.<internal>.EventEmitter">View Summary</a>)</h4><ul class="tsd-hierarchy"><li class="tsd-hierarchy-item"><span class="tsd-hierarchy-target">EventEmitter</span><ul class="tsd-hierarchy"><li class="tsd-hierarchy-item"><a href="../classes/Backend_Script_API._internal_.EventEmitter.html" class="tsd-signature-type tsd-kind-class">EventEmitter</a></li></ul></li></ul></section><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:591</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg><h5 class="tsd-index-heading uppercase">Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="#capturerejectionsymbol" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[capture<wbr/>Rejection<wbr/>Symbol]?</span></a>
|
||
<a href="#addlistener" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Listener</span></a>
|
||
<a href="#emit" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a>
|
||
<a href="#eventnames" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>event<wbr/>Names</span></a>
|
||
<a href="#getmaxlisteners" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a>
|
||
<a href="#listenercount" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a>
|
||
<a href="#listeners" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listeners</span></a>
|
||
<a href="#off" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a>
|
||
<a href="#on" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a>
|
||
<a href="#once" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a>
|
||
<a href="#prependlistener" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Listener</span></a>
|
||
<a href="#prependoncelistener" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Once<wbr/>Listener</span></a>
|
||
<a href="#rawlisteners" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>raw<wbr/>Listeners</span></a>
|
||
<a href="#removealllisteners" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>All<wbr/>Listeners</span></a>
|
||
<a href="#removelistener" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Listener</span></a>
|
||
<a href="#setmaxlisteners" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a>
|
||
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Methods</h2></summary><section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="capturerejectionsymbol"><code class="tsd-tag">Optional</code><span>[capture<wbr/>Rejection<wbr/>Symbol]</span><a href="#capturerejectionsymbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="capturerejectionsymbol-1"><span class="tsd-kind-call-signature">"[captureRejectionSymbol]"</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#capturerejectionsymbol-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="capturerejectionsymbolk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">error</span>: <span class="tsd-signature-type">Error</span></span></li><li><span><span class="tsd-kind-parameter">event</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:592</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="addlistener"><span>add<wbr/>Listener</span><a href="#addlistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="addlistener-1"><span class="tsd-kind-call-signature">addListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#addlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#addlistener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Alias for <code>emitter.on(eventName, listener)</code>.</p>
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="addlistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#addlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since">Since<a href="#since" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:597</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="emit"><span>emit</span><a href="#emit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="emit-1"><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#emitk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><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> <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#emit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><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
|
||
to each.</p>
|
||
<p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">myEmitter</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-6">// First listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-2">function</span><span class="hl-1"> </span><span class="hl-0">firstListener</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'Helloooo! first listener'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-6">// Second listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-2">function</span><span class="hl-1"> </span><span class="hl-0">secondListener</span><span class="hl-1">(</span><span class="hl-5">arg1</span><span class="hl-1">, </span><span class="hl-5">arg2</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">`event with parameters </span><span class="hl-2">${</span><span class="hl-5">arg1</span><span class="hl-2">}</span><span class="hl-3">, </span><span class="hl-2">${</span><span class="hl-5">arg2</span><span class="hl-2">}</span><span class="hl-3"> in second listener`</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-6">// Third listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-2">function</span><span class="hl-1"> </span><span class="hl-0">thirdListener</span><span class="hl-1">(...</span><span class="hl-5">args</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">parameters</span><span class="hl-1"> = </span><span class="hl-5">args</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-3">', '</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">`event with parameters </span><span class="hl-2">${</span><span class="hl-5">parameters</span><span class="hl-2">}</span><span class="hl-3"> in third listener`</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">listeners</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">));</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-9">1</span><span class="hl-1">, </span><span class="hl-9">2</span><span class="hl-1">, </span><span class="hl-9">3</span><span class="hl-1">, </span><span class="hl-9">4</span><span class="hl-1">, </span><span class="hl-9">5</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Prints:</span><br/><span class="hl-6">// [</span><br/><span class="hl-6">// [Function: firstListener],</span><br/><span class="hl-6">// [Function: secondListener],</span><br/><span class="hl-6">// [Function: thirdListener]</span><br/><span class="hl-6">// ]</span><br/><span class="hl-6">// Helloooo! first listener</span><br/><span class="hl-6">// event with parameters 1, 2 in second listener</span><br/><span class="hl-6">// event with parameters 1, 2, 3, 4, 5 in third listener</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="emitk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <a href="../types/Backend_Script_API._internal_.Args.html" class="tsd-signature-type tsd-kind-type-alias">Args</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#emitk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-1">Since<a href="#since-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:859</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="eventnames"><span>event<wbr/>Names</span><a href="#eventnames" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="eventnames-1"><span class="tsd-kind-call-signature">eventNames</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> <a href="../types/Backend_Script_API._internal_.Key2.html" class="tsd-signature-type tsd-kind-type-alias">Key2</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span>)<span class="tsd-signature-symbol">[]</span><a href="#eventnames-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns an array listing the events for which the emitter has registered
|
||
listeners. The values in the array are strings or <code>Symbol</code>s.</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">myEE</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> {});</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'bar'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> {});</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">sym</span><span class="hl-1"> = </span><span class="hl-0">Symbol</span><span class="hl-1">(</span><span class="hl-3">'symbol'</span><span class="hl-1">);</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-5">sym</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> {});</span><br/><br/><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">eventNames</span><span class="hl-1">());</span><br/><span class="hl-6">// Prints: [ 'foo', 'bar', Symbol(symbol) ]</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><h4 class="tsd-returns-title">Returns ((<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> <a href="../types/Backend_Script_API._internal_.Key2.html" class="tsd-signature-type tsd-kind-type-alias">Key2</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span>)<span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-2">Since<a href="#since-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:922</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="getmaxlisteners"><span>get<wbr/>Max<wbr/>Listeners</span><a href="#getmaxlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="getmaxlisteners-1"><span class="tsd-kind-call-signature">getMaxListeners</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getmaxlisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="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 <a href="../classes/Backend_Script_API._internal_.EventEmitter.html#defaultmaxlisteners" class="tsd-kind-property">EventEmitter.defaultMaxListeners</a>.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-3">Since<a href="#since-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v1.0.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:774</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="listenercount"><span>listener<wbr/>Count</span><a href="#listenercount" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="listenercount-1"><span class="tsd-kind-call-signature">listenerCount</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenercountk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">?:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#listenercount-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="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><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="listenercountk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The name of the event being listened for</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenercountk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The event handler function</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-4">Since<a href="#since-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v3.2.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:868</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="listeners"><span>listeners</span><a href="#listeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="listeners-1"><span class="tsd-kind-call-signature">listeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><a href="#listeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>.</p>
|
||
<pre><code class="js"><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">util</span><span class="hl-1">.</span><span class="hl-0">inspect</span><span class="hl-1">(</span><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">listeners</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">)));</span><br/><span class="hl-6">// Prints: [ [Function] ]</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="listenersk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#listenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-5">Since<a href="#since-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:787</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="off"><span>off</span><a href="#off" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="off-1"><span class="tsd-kind-call-signature">off</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#offk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#off-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Alias for <code>emitter.removeListener()</code>.</p>
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="offk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#offk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-6">Since<a href="#since-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v10.0.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:747</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="on"><span>on</span><a href="#on" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="on-1"><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#onk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#on-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="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>
|
||
<pre><code class="js"><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</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
|
||
event listener to the beginning of the listeners array.</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">myEE</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'a'</span><span class="hl-1">));</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">prependListener</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'b'</span><span class="hl-1">));</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">);</span><br/><span class="hl-6">// Prints:</span><br/><span class="hl-6">// b</span><br/><span class="hl-6">// a</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="onk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#onk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-7">Since<a href="#since-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.101</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:629</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="once"><span>once</span><a href="#once" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="once-1"><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#oncek">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#once-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><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
|
||
next time <code>eventName</code> is triggered, this listener is removed and then invoked.</p>
|
||
<pre><code class="js"><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'Ah, we have our first user!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
||
<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
|
||
event listener to the beginning of the listeners array.</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">myEE</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'a'</span><span class="hl-1">));</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">prependOnceListener</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'b'</span><span class="hl-1">));</span><br/><span class="hl-5">myEE</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">);</span><br/><span class="hl-6">// Prints:</span><br/><span class="hl-6">// b</span><br/><span class="hl-6">// a</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="oncek"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#oncek">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-8">Since<a href="#since-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.3.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:659</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="prependlistener"><span>prepend<wbr/>Listener</span><a href="#prependlistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="prependlistener-1"><span class="tsd-kind-call-signature">prependListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#prependlistener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Adds the <code>listener</code> function to the <em>beginning</em> 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>
|
||
<pre><code class="js"><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">prependListener</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="prependlistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependlistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-9">Since<a href="#since-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:886</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="prependoncelistener"><span>prepend<wbr/>Once<wbr/>Listener</span><a href="#prependoncelistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="prependoncelistener-1"><span class="tsd-kind-call-signature">prependOnceListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependoncelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#prependoncelistener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><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
|
||
listener is removed, and then invoked.</p>
|
||
<pre><code class="js"><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">prependOnceListener</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'Ah, we have our first user!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="prependoncelistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-10">Since<a href="#since-10" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:902</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="rawlisteners"><span>raw<wbr/>Listeners</span><a href="#rawlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="rawlisteners-1"><span class="tsd-kind-call-signature">rawListeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#rawlistenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><a href="#rawlisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>,
|
||
including any wrappers (such as those created by <code>.once()</code>).</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">emitter</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-5">emitter</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-3">'log'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'log once'</span><span class="hl-1">));</span><br/><br/><span class="hl-6">// Returns a new Array with a function `onceWrapper` which has a property</span><br/><span class="hl-6">// `listener` which contains the original listener bound above</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">listeners</span><span class="hl-1"> = </span><span class="hl-5">emitter</span><span class="hl-1">.</span><span class="hl-0">rawListeners</span><span class="hl-1">(</span><span class="hl-3">'log'</span><span class="hl-1">);</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">logFnWrapper</span><span class="hl-1"> = </span><span class="hl-5">listeners</span><span class="hl-1">[</span><span class="hl-9">0</span><span class="hl-1">];</span><br/><br/><span class="hl-6">// Logs "log once" to the console and does not unbind the `once` event</span><br/><span class="hl-5">logFnWrapper</span><span class="hl-1">.</span><span class="hl-0">listener</span><span class="hl-1">();</span><br/><br/><span class="hl-6">// Logs "log once" to the console and removes the listener</span><br/><span class="hl-0">logFnWrapper</span><span class="hl-1">();</span><br/><br/><span class="hl-5">emitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'log'</span><span class="hl-1">, () </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'log persistently'</span><span class="hl-1">));</span><br/><span class="hl-6">// Will return a new Array with a single function bound by `.on()` above</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">newListeners</span><span class="hl-1"> = </span><span class="hl-5">emitter</span><span class="hl-1">.</span><span class="hl-0">rawListeners</span><span class="hl-1">(</span><span class="hl-3">'log'</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Logs "log persistently" twice</span><br/><span class="hl-5">newListeners</span><span class="hl-1">[</span><span class="hl-9">0</span><span class="hl-1">]();</span><br/><span class="hl-5">emitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'log'</span><span class="hl-1">);</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="rawlistenersk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#rawlistenersk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-11">Since<a href="#since-11" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v9.4.0</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:818</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="removealllisteners"><span>remove<wbr/>All<wbr/>Listeners</span><a href="#removealllisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="removealllisteners-1"><span class="tsd-kind-call-signature">removeAllListeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">?:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#removealllisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="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,
|
||
particularly when the <code>EventEmitter</code> instance was created by some other
|
||
component or module (e.g. sockets or file streams).</p>
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-12">Since<a href="#since-12" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:758</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="removelistener"><span>remove<wbr/>Listener</span><a href="#removelistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="removelistener-1"><span class="tsd-kind-call-signature">removeListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#removelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#removelistener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><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>
|
||
<pre><code class="js"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-0">callback</span><span class="hl-1"> = (</span><span class="hl-5">stream</span><span class="hl-1">) </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, </span><span class="hl-5">callback</span><span class="hl-1">);</span><br/><span class="hl-6">// ...</span><br/><span class="hl-5">server</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-3">'connection'</span><span class="hl-1">, </span><span class="hl-5">callback</span><span class="hl-1">);</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p><code>removeListener()</code> will remove, at most, one instance of a listener from the
|
||
listener array. If any single listener has been added multiple times to the
|
||
listener array for the specified <code>eventName</code>, then <code>removeListener()</code> must be
|
||
called multiple times to remove each instance.</p>
|
||
<p>Once an event is emitted, all listeners attached to it at the
|
||
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><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">class</span><span class="hl-1"> </span><span class="hl-8">MyEmitter</span><span class="hl-1"> </span><span class="hl-2">extends</span><span class="hl-1"> </span><span class="hl-8">EventEmitter</span><span class="hl-1"> {}</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">myEmitter</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">MyEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-0">callbackA</span><span class="hl-1"> = () </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'A'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-5">callbackB</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-0">callbackB</span><span class="hl-1"> = () </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'B'</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-5">callbackA</span><span class="hl-1">);</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">, </span><span class="hl-5">callbackB</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// callbackA removes listener callbackB but it will still be called.</span><br/><span class="hl-6">// Internal listener array at time of emit [callbackA, callbackB]</span><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">);</span><br/><span class="hl-6">// Prints:</span><br/><span class="hl-6">// A</span><br/><span class="hl-6">// B</span><br/><br/><span class="hl-6">// callbackB is now removed.</span><br/><span class="hl-6">// Internal listener array [callbackA]</span><br/><span class="hl-5">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'event'</span><span class="hl-1">);</span><br/><span class="hl-6">// Prints:</span><br/><span class="hl-6">// A</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Because listeners are managed using an internal array, calling this will
|
||
change the position indices of any listener registered <em>after</em> the listener
|
||
being removed. This will not impact the order in which listeners are called,
|
||
but it means that any copies of the listener array as returned by
|
||
the <code>emitter.listeners()</code> method will need to be recreated.</p>
|
||
<p>When a single function has been added as a handler multiple times for a single
|
||
event (as in the example below), <code>removeListener()</code> will remove the most
|
||
recently added instance. In the example the <code>once('ping')</code> listener is removed:</p>
|
||
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">EventEmitter</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-2">function</span><span class="hl-1"> </span><span class="hl-0">pong</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">'pong'</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-5">ee</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'ping'</span><span class="hl-1">, </span><span class="hl-5">pong</span><span class="hl-1">);</span><br/><span class="hl-5">ee</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-3">'ping'</span><span class="hl-1">, </span><span class="hl-5">pong</span><span class="hl-1">);</span><br/><span class="hl-5">ee</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-3">'ping'</span><span class="hl-1">, </span><span class="hl-5">pong</span><span class="hl-1">);</span><br/><br/><span class="hl-5">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'ping'</span><span class="hl-1">);</span><br/><span class="hl-5">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-3">'ping'</span><span class="hl-1">);</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
||
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="removelistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <a href="../types/Backend_Script_API._internal_.Key.html" class="tsd-signature-type tsd-kind-type-alias">Key</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <a href="../types/Backend_Script_API._internal_.Listener.html" class="tsd-signature-type tsd-kind-type-alias">Listener</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="../classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html#removelistenerk">K</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#t">T</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-13">Since<a href="#since-13" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:742</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="setmaxlisteners"><span>set<wbr/>Max<wbr/>Listeners</span><a href="#setmaxlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="setmaxlisteners-1"><span class="tsd-kind-call-signature">setMaxListeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">n</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#setmaxlisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><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
|
||
added for a particular event. This is a useful default that helps finding
|
||
memory leaks. The <code>emitter.setMaxListeners()</code> method allows the limit to be
|
||
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>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">n</span>: <span class="tsd-signature-type">number</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-14">Since<a href="#since-14" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.3.5</p>
|
||
</div></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:768</li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><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><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><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></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#capturerejectionsymbol" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[capture<wbr/>Rejection<wbr/>Symbol]</span></a><a href="#addlistener" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Listener</span></a><a href="#emit" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a><a href="#eventnames" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>event<wbr/>Names</span></a><a href="#getmaxlisteners" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a><a href="#listenercount" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a><a href="#listeners" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listeners</span></a><a href="#off" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a><a href="#on" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a><a href="#once" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a><a href="#prependlistener" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Listener</span></a><a href="#prependoncelistener" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Once<wbr/>Listener</span></a><a href="#rawlisteners" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>raw<wbr/>Listeners</span></a><a href="#removealllisteners" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>All<wbr/>Listeners</span></a><a href="#removelistener" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Listener</span></a><a href="#setmaxlisteners" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">trilium</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|