@n1xyz/nord-ts 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/bridge/client.js +45 -6
  2. package/dist/gen/common.js +1 -1
  3. package/dist/gen/nord.d.ts +61 -29
  4. package/dist/gen/nord.js +723 -130
  5. package/dist/idl/bridge.d.ts +569 -2
  6. package/dist/idl/bridge.js +5 -927
  7. package/dist/idl/bridge.json +75 -62
  8. package/dist/idl/index.d.ts +71 -49
  9. package/dist/index.d.ts +1 -3
  10. package/dist/index.js +6 -13
  11. package/dist/nord/api/actions.d.ts +7 -2
  12. package/dist/nord/api/actions.js +7 -1
  13. package/dist/nord/api/core.d.ts +1 -1
  14. package/dist/nord/api/core.js +3 -3
  15. package/dist/nord/api/market.js +1 -3
  16. package/dist/nord/api/queries.js +2 -2
  17. package/dist/nord/client/Nord.d.ts +9 -14
  18. package/dist/nord/client/Nord.js +27 -38
  19. package/dist/nord/client/NordUser.d.ts +7 -23
  20. package/dist/nord/client/NordUser.js +79 -151
  21. package/dist/nord/utils/NordError.js +5 -2
  22. package/dist/types.d.ts +34 -50
  23. package/dist/utils.d.ts +2 -0
  24. package/dist/utils.js +14 -0
  25. package/dist/websocket/NordWebSocketClient.js +0 -2
  26. package/package.json +20 -18
  27. package/protoc-generate.sh +0 -0
  28. package/src/idl/bridge.json +75 -62
  29. package/src/index.ts +9 -12
  30. package/src/nord/api/actions.ts +14 -3
  31. package/src/nord/api/core.ts +4 -2
  32. package/src/nord/api/market.ts +1 -4
  33. package/src/nord/api/queries.ts +2 -2
  34. package/src/nord/client/Nord.ts +45 -50
  35. package/src/nord/client/NordUser.ts +107 -178
  36. package/src/nord/utils/NordError.ts +6 -2
  37. package/src/types.ts +34 -49
  38. package/src/utils.ts +18 -0
  39. package/src/websocket/NordWebSocketClient.ts +0 -2
  40. package/tsconfig.json +1 -1
  41. package/docs/.nojekyll +0 -1
  42. package/docs/assets/hierarchy.js +0 -1
  43. package/docs/assets/highlight.css +0 -92
  44. package/docs/assets/icons.js +0 -18
  45. package/docs/assets/icons.svg +0 -1
  46. package/docs/assets/main.js +0 -60
  47. package/docs/assets/navigation.js +0 -1
  48. package/docs/assets/search.js +0 -1
  49. package/docs/assets/style.css +0 -1611
  50. package/docs/classes/Nord.html +0 -189
  51. package/docs/classes/NordError.html +0 -24
  52. package/docs/classes/NordUser.html +0 -115
  53. package/docs/classes/NordWebSocketClient.html +0 -330
  54. package/docs/classes/SolanaBridgeClient.html +0 -86
  55. package/docs/classes/Subscriber.html +0 -10
  56. package/docs/enums/FillMode.html +0 -5
  57. package/docs/enums/KeyType.html +0 -4
  58. package/docs/enums/MetricPeriod.html +0 -9
  59. package/docs/enums/PdaSeedType.html +0 -9
  60. package/docs/enums/PeakTpsPeriodUnit.html +0 -15
  61. package/docs/enums/Side.html +0 -3
  62. package/docs/enums/WebSocketMessageType.html +0 -7
  63. package/docs/functions/actionQueryRollman.html +0 -6
  64. package/docs/functions/actionsQueryRollman.html +0 -6
  65. package/docs/functions/aggregateMetrics-1.html +0 -7
  66. package/docs/functions/assert.html +0 -1
  67. package/docs/functions/bigIntToProtoU128.html +0 -4
  68. package/docs/functions/bridgeToBN.html +0 -5
  69. package/docs/functions/bufferToHex.html +0 -4
  70. package/docs/functions/cancelOrder.html +0 -1
  71. package/docs/functions/checkPubKeyLength.html +0 -1
  72. package/docs/functions/checkedFetch.html +0 -6
  73. package/docs/functions/createSession.html +0 -1
  74. package/docs/functions/decodeLengthDelimited.html +0 -11
  75. package/docs/functions/encodeLengthDelimited.html +0 -6
  76. package/docs/functions/fillModeToProtoFillMode.html +0 -5
  77. package/docs/functions/findMarket.html +0 -1
  78. package/docs/functions/findPda.html +0 -6
  79. package/docs/functions/findToken.html +0 -1
  80. package/docs/functions/fromBN.html +0 -5
  81. package/docs/functions/getAccount.html +0 -6
  82. package/docs/functions/getActionNonce.html +0 -5
  83. package/docs/functions/getCurrentTps.html +0 -6
  84. package/docs/functions/getInfo.html +0 -5
  85. package/docs/functions/getLastActionId.html +0 -5
  86. package/docs/functions/getMedianLatency.html +0 -6
  87. package/docs/functions/getOrderbook.html +0 -6
  88. package/docs/functions/getPeakTps.html +0 -6
  89. package/docs/functions/getTimestamp.html +0 -5
  90. package/docs/functions/getTotalTransactions.html +0 -5
  91. package/docs/functions/getTrades.html +0 -6
  92. package/docs/functions/getUserAccountIds.html +0 -6
  93. package/docs/functions/hexToBuffer.html +0 -4
  94. package/docs/functions/initWebSocketClient.html +0 -12
  95. package/docs/functions/keypairFromPrivateKey.html +0 -4
  96. package/docs/functions/makeSigningFunction.html +0 -4
  97. package/docs/functions/makeWalletSignFn.html +0 -6
  98. package/docs/functions/marketsStats.html +0 -5
  99. package/docs/functions/optExpect.html +0 -5
  100. package/docs/functions/optMap.html +0 -5
  101. package/docs/functions/optUnwrap.html +0 -2
  102. package/docs/functions/panic.html +0 -1
  103. package/docs/functions/placeOrder.html +0 -1
  104. package/docs/functions/queryAction.html +0 -6
  105. package/docs/functions/queryPrometheus.html +0 -6
  106. package/docs/functions/queryRecentActions.html +0 -7
  107. package/docs/functions/revokeSession.html +0 -1
  108. package/docs/functions/shortenPublicKey.html +0 -5
  109. package/docs/functions/signAction.html +0 -6
  110. package/docs/functions/toBN.html +0 -5
  111. package/docs/functions/toScaledU128.html +0 -8
  112. package/docs/functions/toScaledU64.html +0 -8
  113. package/docs/functions/transfer.html +0 -1
  114. package/docs/functions/withdraw.html +0 -1
  115. package/docs/hierarchy.html +0 -1
  116. package/docs/index.html +0 -40
  117. package/docs/interfaces/Account.html +0 -8
  118. package/docs/interfaces/ActionInfo.html +0 -8
  119. package/docs/interfaces/ActionNonceResponse.html +0 -3
  120. package/docs/interfaces/ActionQuery.html +0 -4
  121. package/docs/interfaces/ActionResponse.html +0 -8
  122. package/docs/interfaces/ActionsExtendedInfo.html +0 -10
  123. package/docs/interfaces/ActionsQuery.html +0 -5
  124. package/docs/interfaces/ActionsResponse.html +0 -6
  125. package/docs/interfaces/AggregateMetrics.html +0 -12
  126. package/docs/interfaces/BlockFacts.html +0 -10
  127. package/docs/interfaces/BlockQuery.html +0 -6
  128. package/docs/interfaces/BlockResponse.html +0 -6
  129. package/docs/interfaces/BlockSummary.html +0 -8
  130. package/docs/interfaces/BlockSummaryResponse.html +0 -6
  131. package/docs/interfaces/DeltaEvent.html +0 -6
  132. package/docs/interfaces/DepositSplParams.html +0 -10
  133. package/docs/interfaces/Info.html +0 -3
  134. package/docs/interfaces/Market.html +0 -8
  135. package/docs/interfaces/MarketStats.html +0 -7
  136. package/docs/interfaces/MarketsStatsResponse.html +0 -2
  137. package/docs/interfaces/NordConfig.html +0 -24
  138. package/docs/interfaces/NordWebSocketClientEvents.html +0 -4
  139. package/docs/interfaces/NordWebSocketEvents.html +0 -8
  140. package/docs/interfaces/Order.html +0 -6
  141. package/docs/interfaces/OrderInfo.html +0 -6
  142. package/docs/interfaces/OrderbookEntry.html +0 -4
  143. package/docs/interfaces/OrderbookQuery.html +0 -6
  144. package/docs/interfaces/OrderbookResponse.html +0 -6
  145. package/docs/interfaces/OrderbookSubscription.html +0 -159
  146. package/docs/interfaces/PerpMarketStats.html +0 -5
  147. package/docs/interfaces/RollmanActionExtendedInfo.html +0 -4
  148. package/docs/interfaces/RollmanActionInfo.html +0 -4
  149. package/docs/interfaces/RollmanActionResponse.html +0 -4
  150. package/docs/interfaces/RollmanActionsResponse.html +0 -2
  151. package/docs/interfaces/RollmanBlockResponse.html +0 -3
  152. package/docs/interfaces/SPLTokenInfo.html +0 -10
  153. package/docs/interfaces/SolanaBridgeConfig.html +0 -10
  154. package/docs/interfaces/StateFacts.html +0 -10
  155. package/docs/interfaces/SubscriberConfig.html +0 -3
  156. package/docs/interfaces/TimestampResponse.html +0 -3
  157. package/docs/interfaces/Token.html +0 -5
  158. package/docs/interfaces/TokenInfo.html +0 -6
  159. package/docs/interfaces/Trade.html +0 -5
  160. package/docs/interfaces/TradeSubscription.html +0 -159
  161. package/docs/interfaces/Trades.html +0 -5
  162. package/docs/interfaces/TradesQuery.html +0 -6
  163. package/docs/interfaces/TradesResponse.html +0 -7
  164. package/docs/interfaces/TransferParams.html +0 -8
  165. package/docs/interfaces/UserAccountIdsQuery.html +0 -3
  166. package/docs/interfaces/UserAccountIdsResponse.html +0 -3
  167. package/docs/interfaces/WebSocketAccountUpdate.html +0 -6
  168. package/docs/interfaces/WebSocketDeltaUpdate.html +0 -9
  169. package/docs/interfaces/WebSocketSubscription.html +0 -4
  170. package/docs/interfaces/WebSocketTradeUpdate.html +0 -6
  171. package/docs/interfaces/WithdrawalClaim.html +0 -14
  172. package/docs/interfaces/WithdrawalParams.html +0 -8
  173. package/docs/modules.html +0 -1
  174. package/docs/types/BigIntValue.html +0 -2
  175. package/docs/types/SubscriptionPattern.html +0 -4
  176. package/docs/types/SubscriptionType.html +0 -2
  177. package/docs/types/WebSocketMessage.html +0 -1
  178. package/docs/variables/DEBUG_KEYS.html +0 -1
  179. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +0 -1
  180. package/docs/variables/DEV_TOKEN_INFOS.html +0 -1
  181. package/docs/variables/DEV_URL.html +0 -1
  182. package/docs/variables/MAX_BUFFER_LEN.html +0 -1
  183. package/docs/variables/SESSION_TTL.html +0 -1
  184. package/docs/variables/WEBSERVER_DEV_URL.html +0 -1
  185. package/docs/variables/ZERO_DECIMAL.html +0 -1
  186. package/docs/variables/_private.html +0 -2
  187. package/idl-generate.sh +0 -4
  188. package/src/bridge/client.ts +0 -498
  189. package/src/bridge/const.ts +0 -53
  190. package/src/bridge/index.ts +0 -6
  191. package/src/bridge/types.ts +0 -129
  192. package/src/bridge/utils.ts +0 -140
  193. package/src/gen/common.ts +0 -297
  194. package/src/gen/nord.ts +0 -6723
  195. package/src/idl/index.ts +0 -2
@@ -1,330 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>NordWebSocketClient | @n1xyz/nord-ts</title><meta name="description" content="Documentation for @n1xyz/nord-ts"/><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(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@n1xyz/nord-ts</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@n1xyz/nord-ts</a></li><li><a href="NordWebSocketClient.html">NordWebSocketClient</a></li></ul><h1>Class NordWebSocketClient</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>WebSocket client for Nord exchange</p>
2
- <p>This client connects to one of the specific Nord WebSocket endpoints:</p>
3
- <p>Each endpoint handles a specific type of data and subscriptions must match
4
- the endpoint type (e.g., only 'trades@BTCUSDC' subscriptions are valid on
5
- the /ws/trades endpoint).</p>
6
- </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-hierarchy" data-refl="1101"><h4>Hierarchy</h4><ul class="tsd-hierarchy"><li class="tsd-hierarchy-item"><span class="tsd-signature-type">EventEmitter</span><ul class="tsd-hierarchy"><li class="tsd-hierarchy-item"><span class="tsd-hierarchy-target">NordWebSocketClient</span></li></ul></li></ul></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/NordWebSocketClientEvents.html" class="tsd-signature-type tsd-kind-interface">NordWebSocketClientEvents</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L44">src/websocket/NordWebSocketClient.ts:44</a></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"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="NordWebSocketClient.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
7
- </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="NordWebSocketClient.html#capturerejections" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejections</span></a>
8
- <a href="NordWebSocketClient.html#capturerejectionsymbol" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejection<wbr/>Symbol</span></a>
9
- <a href="NordWebSocketClient.html#defaultmaxlisteners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>default<wbr/>Max<wbr/>Listeners</span></a>
10
- <a href="NordWebSocketClient.html#errormonitor" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>error<wbr/>Monitor</span></a>
11
- </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="NordWebSocketClient.html#capturerejectionsymbol-1" class="tsd-index-link tsd-is-inherited 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>
12
- <a href="NordWebSocketClient.html#addlistener" class="tsd-index-link tsd-is-inherited 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>
13
- <a href="NordWebSocketClient.html#close" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>close</span></a>
14
- <a href="NordWebSocketClient.html#connect" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>connect</span></a>
15
- <a href="NordWebSocketClient.html#emit" class="tsd-index-link tsd-is-inherited 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>
16
- <a href="NordWebSocketClient.html#eventnames" class="tsd-index-link tsd-is-inherited 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>
17
- <a href="NordWebSocketClient.html#getmaxlisteners" class="tsd-index-link tsd-is-inherited 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>
18
- <a href="NordWebSocketClient.html#listenercount" class="tsd-index-link tsd-is-inherited 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>
19
- <a href="NordWebSocketClient.html#listeners" class="tsd-index-link tsd-is-inherited 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>
20
- <a href="NordWebSocketClient.html#off" class="tsd-index-link tsd-is-inherited 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>
21
- <a href="NordWebSocketClient.html#on" class="tsd-index-link tsd-is-inherited 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>
22
- <a href="NordWebSocketClient.html#once" class="tsd-index-link tsd-is-inherited 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>
23
- <a href="NordWebSocketClient.html#prependlistener" class="tsd-index-link tsd-is-inherited 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>
24
- <a href="NordWebSocketClient.html#prependoncelistener" class="tsd-index-link tsd-is-inherited 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>
25
- <a href="NordWebSocketClient.html#rawlisteners" class="tsd-index-link tsd-is-inherited 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>
26
- <a href="NordWebSocketClient.html#removealllisteners" class="tsd-index-link tsd-is-inherited 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>
27
- <a href="NordWebSocketClient.html#removelistener" class="tsd-index-link tsd-is-inherited 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>
28
- <a href="NordWebSocketClient.html#setmaxlisteners" class="tsd-index-link tsd-is-inherited 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>
29
- <a href="NordWebSocketClient.html#subscribe" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>subscribe</span></a>
30
- <a href="NordWebSocketClient.html#unsubscribe" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unsubscribe</span></a>
31
- <a href="NordWebSocketClient.html#addabortlistener" class="tsd-index-link tsd-is-inherited 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/>Abort<wbr/>Listener</span></a>
32
- <a href="NordWebSocketClient.html#geteventlisteners" class="tsd-index-link tsd-is-inherited 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/>Event<wbr/>Listeners</span></a>
33
- <a href="NordWebSocketClient.html#getmaxlisteners-2" class="tsd-index-link tsd-is-inherited 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>
34
- <a href="NordWebSocketClient.html#listenercount-2" class="tsd-index-link deprecated tsd-is-inherited 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>
35
- <a href="NordWebSocketClient.html#on-2" class="tsd-index-link tsd-is-inherited 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>
36
- <a href="NordWebSocketClient.html#once-2" class="tsd-index-link tsd-is-inherited 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>
37
- <a href="NordWebSocketClient.html#setmaxlisteners-2" class="tsd-index-link tsd-is-inherited 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>
38
- </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-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" 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"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructornordwebsocketclient" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">NordWebSocketClient</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="NordWebSocketClient.html" class="tsd-signature-type tsd-kind-class">NordWebSocketClient</a><a href="#constructornordwebsocketclient" 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>Create a new NordWebSocketClient</p>
39
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">url</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>WebSocket server URL</p>
40
- </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="NordWebSocketClient.html" class="tsd-signature-type tsd-kind-class">NordWebSocketClient</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Overrides EventEmitter.constructor</p><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L62">src/websocket/NordWebSocketClient.ts:62</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="capturerejections" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>capture<wbr/>Rejections</span><a href="#capturerejections" 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><div class="tsd-signature"><span class="tsd-kind-property">captureRejections</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Value: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean</a></p>
41
- <p>Change the default <code>captureRejections</code> option on all new <code>EventEmitter</code> objects.</p>
42
- </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since" class="tsd-anchor"></a>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>v13.4.0, v12.16.0</p>
43
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejections</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:459</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="capturerejectionsymbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code> <code class="tsd-tag">Readonly</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><div class="tsd-signature"><span class="tsd-kind-property">captureRejectionSymbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof</span> <a href="NordWebSocketClient.html#capturerejectionsymbol" class="tsd-signature-type tsd-kind-property">captureRejectionSymbol</a></div><div class="tsd-comment tsd-typography"><p>Value: <code>Symbol.for('nodejs.rejection')</code></p>
44
- <p>See how to write a custom <code>rejection handler</code>.</p>
45
- </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-1" class="tsd-anchor"></a>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>v13.4.0, v12.16.0</p>
46
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejectionSymbol</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:452</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="defaultmaxlisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>default<wbr/>Max<wbr/>Listeners</span><a href="#defaultmaxlisteners" 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><div class="tsd-signature"><span class="tsd-kind-property">defaultMaxListeners</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>By default, a maximum of <code>10</code> listeners can be registered for any single
47
- event. This limit can be changed for individual <code>EventEmitter</code> instances
48
- using the <code>emitter.setMaxListeners(n)</code> method. To change the default
49
- for <em>all</em><code>EventEmitter</code> instances, the <code>events.defaultMaxListeners</code> property
50
- can be used. If this value is not a positive number, a <code>RangeError</code> is thrown.</p>
51
- <p>Take caution when setting the <code>events.defaultMaxListeners</code> because the
52
- change affects <em>all</em> <code>EventEmitter</code> instances, including those created before
53
- the change is made. However, calling <code>emitter.setMaxListeners(n)</code> still has
54
- precedence over <code>events.defaultMaxListeners</code>.</p>
55
- <p>This is not a hard limit. The <code>EventEmitter</code> instance will allow
56
- more listeners to be added but will output a trace warning to stderr indicating
57
- that a &quot;possible EventEmitter memory leak&quot; has been detected. For any single
58
- <code>EventEmitter</code>, the <code>emitter.getMaxListeners()</code> and <code>emitter.setMaxListeners()</code> methods can be used to
59
- temporarily avoid this warning:</p>
60
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">emitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">setMaxListeners</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">getMaxListeners</span><span class="hl-2">() + </span><span class="hl-8">1</span><span class="hl-2">);</span><br/><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-0">// do stuff</span><br/><span class="hl-2"> </span><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">setMaxListeners</span><span class="hl-2">(</span><span class="hl-5">Math</span><span class="hl-2">.</span><span class="hl-1">max</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">getMaxListeners</span><span class="hl-2">() - </span><span class="hl-8">1</span><span class="hl-2">, </span><span class="hl-8">0</span><span class="hl-2">));</span><br/><span class="hl-2">});</span>
61
- </code><button type="button">Copy</button></pre>
62
-
63
- <p>The <code>--trace-warnings</code> command-line flag can be used to display the
64
- stack trace for such warnings.</p>
65
- <p>The emitted warning can be inspected with <code>process.on('warning')</code> and will
66
- have the additional <code>emitter</code>, <code>type</code>, and <code>count</code> properties, referring to
67
- the event emitter instance, the event's name and the number of attached
68
- listeners, respectively.
69
- Its <code>name</code> property is set to <code>'MaxListenersExceededWarning'</code>.</p>
70
- </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-2" class="tsd-anchor"></a>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>v0.11.2</p>
71
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.defaultMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:498</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="errormonitor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code> <code class="tsd-tag">Readonly</code><span>error<wbr/>Monitor</span><a href="#errormonitor" 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><div class="tsd-signature"><span class="tsd-kind-property">errorMonitor</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof</span> <a href="NordWebSocketClient.html#errormonitor" class="tsd-signature-type tsd-kind-property">errorMonitor</a></div><div class="tsd-comment tsd-typography"><p>This symbol shall be used to install a listener for only monitoring <code>'error'</code> events. Listeners installed using this symbol are called before the regular <code>'error'</code> listeners are called.</p>
72
- <p>Installing a listener using this symbol does not change the behavior once an <code>'error'</code> event is emitted. Therefore, the process will still crash if no
73
- regular <code>'error'</code> listener is installed.</p>
74
- </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-3" class="tsd-anchor"></a>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>v13.6.0, v12.17.0</p>
75
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.errorMonitor</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:445</li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><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</h2></summary><section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="capturerejectionsymbol-1" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Optional</code><span>[capture<wbr/>Rejection<wbr/>Symbol]</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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="capturerejectionsymbol-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">&quot;[captureRejectionSymbol]&quot;</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">&gt;</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> <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><br/>    <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AnyRest</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-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></div><div class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="capturerejectionsymbolk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">AnyRest</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><p>Inherited from EventEmitter.[captureRejectionSymbol]</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:136</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="addlistener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="addlistener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">addListener</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#addlistenerk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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><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>
76
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="addlistenerk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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"><a id="since-4" class="tsd-anchor"></a>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>v0.1.26</p>
77
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:597</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="close" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>close</span><a href="#close" 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"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="close-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">close</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#close-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>Close the WebSocket connection</p>
78
- </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L374">src/websocket/NordWebSocketClient.ts:374</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="connect" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>connect</span><a href="#connect" 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"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="connect-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">connect</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#connect-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>Connect to the Nord WebSocket server</p>
79
- </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L163">src/websocket/NordWebSocketClient.ts:163</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="emit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="emit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#emitk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AnyRest</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
80
- to each.</p>
81
- <p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
82
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEmitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// First listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">firstListener</span><span class="hl-2">() {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;Helloooo! first listener&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><span class="hl-0">// Second listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">secondListener</span><span class="hl-2">(</span><span class="hl-5">arg1</span><span class="hl-2">, </span><span class="hl-5">arg2</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">`event with parameters </span><span class="hl-6">${</span><span class="hl-5">arg1</span><span class="hl-6">}</span><span class="hl-3">, </span><span class="hl-6">${</span><span class="hl-5">arg2</span><span class="hl-6">}</span><span class="hl-3"> in second listener`</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><span class="hl-0">// Third listener</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">thirdListener</span><span class="hl-2">(...</span><span class="hl-5">args</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">parameters</span><span class="hl-2"> = </span><span class="hl-5">args</span><span class="hl-2">.</span><span class="hl-1">join</span><span class="hl-2">(</span><span class="hl-3">&#39;, &#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">`event with parameters </span><span class="hl-6">${</span><span class="hl-5">parameters</span><span class="hl-6">}</span><span class="hl-3"> in third listener`</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">listeners</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">));</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-8">1</span><span class="hl-2">, </span><span class="hl-8">2</span><span class="hl-2">, </span><span class="hl-8">3</span><span class="hl-2">, </span><span class="hl-8">4</span><span class="hl-2">, </span><span class="hl-8">5</span><span class="hl-2">);</span><br/><br/><span class="hl-0">// Prints:</span><br/><span class="hl-0">// [</span><br/><span class="hl-0">// [Function: firstListener],</span><br/><span class="hl-0">// [Function: secondListener],</span><br/><span class="hl-0">// [Function: thirdListener]</span><br/><span class="hl-0">// ]</span><br/><span class="hl-0">// Helloooo! first listener</span><br/><span class="hl-0">// event with parameters 1, 2 in second listener</span><br/><span class="hl-0">// event with parameters 1, 2, 3, 4, 5 in third listener</span>
83
- </code><button type="button">Copy</button></pre>
84
-
85
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="emitk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">AnyRest</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"><a id="since-5" class="tsd-anchor"></a>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>
86
- </div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/NordWebSocketClientEvents.html">NordWebSocketClientEvents</a>.<a href="../interfaces/NordWebSocketClientEvents.html#emit">emit</a></p><p>Inherited from EventEmitter.emit</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:859</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="eventnames" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="eventnames-1" class="tsd-anchor"></a><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="#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
87
- listeners. The values in the array are strings or <code>Symbol</code>s.</p>
88
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEE</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {});</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {});</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">sym</span><span class="hl-2"> = </span><span class="hl-1">Symbol</span><span class="hl-2">(</span><span class="hl-3">&#39;symbol&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">sym</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {});</span><br/><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">eventNames</span><span class="hl-2">());</span><br/><span class="hl-0">// Prints: [ &#39;foo&#39;, &#39;bar&#39;, Symbol(symbol) ]</span>
89
- </code><button type="button">Copy</button></pre>
90
-
91
- </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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-6" class="tsd-anchor"></a>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>v6.0.0</p>
92
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.eventNames</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:922</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="getmaxlisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="getmaxlisteners-1" class="tsd-anchor"></a><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
93
- set by <code>emitter.setMaxListeners(n)</code> or defaults to <a href="NordWebSocketClient.html#defaultmaxlisteners" class="tsd-kind-property">EventEmitter.defaultMaxListeners</a>.</p>
94
- </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"><a id="since-7" class="tsd-anchor"></a>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>v1.0.0</p>
95
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:774</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listenercount" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="listenercount-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listenerCount</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#listenercountk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><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-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>.
96
- If <code>listener</code> is provided, it will return how many times the listener is found
97
- in the list of the listeners of the event.</p>
98
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="listenercountk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event being listened for</p>
99
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-type">Function</span></span><div class="tsd-comment tsd-typography"><p>The event handler function</p>
100
- </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"><a id="since-8" class="tsd-anchor"></a>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>v3.2.0</p>
101
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:868</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="listeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listeners</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#listenersk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</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>
102
- <pre><code class="js"><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;someone connected!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">util</span><span class="hl-2">.</span><span class="hl-1">inspect</span><span class="hl-2">(</span><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">listeners</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">)));</span><br/><span class="hl-0">// Prints: [ [Function] ]</span>
103
- </code><button type="button">Copy</button></pre>
104
-
105
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="listenersk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-9" class="tsd-anchor"></a>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>v0.1.26</p>
106
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:787</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="off" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="off-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">off</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#offk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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>
107
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="offk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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"><a id="since-10" class="tsd-anchor"></a>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>v10.0.0</p>
108
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.off</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:747</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="on" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="on-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#onk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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
109
- named <code>eventName</code>. No checks are made to see if the <code>listener</code> has already
110
- been added. Multiple calls passing the same combination of <code>eventName</code> and
111
- <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
112
- <pre><code class="js"><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;someone connected!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span>
113
- </code><button type="button">Copy</button></pre>
114
-
115
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
116
- <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
117
- event listener to the beginning of the listeners array.</p>
118
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEE</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;a&#39;</span><span class="hl-2">));</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">prependListener</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;b&#39;</span><span class="hl-2">));</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">);</span><br/><span class="hl-0">// Prints:</span><br/><span class="hl-0">// b</span><br/><span class="hl-0">// a</span>
119
- </code><button type="button">Copy</button></pre>
120
-
121
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="onk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
122
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
123
- </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"><a id="since-11" class="tsd-anchor"></a>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>v0.1.101</p>
124
- </div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/NordWebSocketClientEvents.html">NordWebSocketClientEvents</a>.<a href="../interfaces/NordWebSocketClientEvents.html#on">on</a></p><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:629</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="once" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="once-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#oncek">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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
125
- next time <code>eventName</code> is triggered, this listener is removed and then invoked.</p>
126
- <pre><code class="js"><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;Ah, we have our first user!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span>
127
- </code><button type="button">Copy</button></pre>
128
-
129
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
130
- <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
131
- event listener to the beginning of the listeners array.</p>
132
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEE</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;a&#39;</span><span class="hl-2">));</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">prependOnceListener</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;b&#39;</span><span class="hl-2">));</span><br/><span class="hl-5">myEE</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">);</span><br/><span class="hl-0">// Prints:</span><br/><span class="hl-0">// b</span><br/><span class="hl-0">// a</span>
133
- </code><button type="button">Copy</button></pre>
134
-
135
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="oncek" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
136
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
137
- </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"><a id="since-12" class="tsd-anchor"></a>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.3.0</p>
138
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:659</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="prependlistener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="prependlistener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prependListener</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#prependlistenerk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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><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
139
- event named <code>eventName</code>. No checks are made to see if the <code>listener</code> has
140
- already been added. Multiple calls passing the same combination of <code>eventName</code>
141
- and <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
142
- <pre><code class="js"><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">prependListener</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;someone connected!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span>
143
- </code><button type="button">Copy</button></pre>
144
-
145
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
146
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="prependlistenerk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
147
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
148
- </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"><a id="since-13" class="tsd-anchor"></a>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>v6.0.0</p>
149
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:886</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="prependoncelistener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="prependoncelistener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prependOnceListener</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#prependoncelistenerk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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><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
150
- listener is removed, and then invoked.</p>
151
- <pre><code class="js"><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">prependOnceListener</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;Ah, we have our first user!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span>
152
- </code><button type="button">Copy</button></pre>
153
-
154
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
155
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="prependoncelistenerk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
156
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
157
- </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"><a id="since-14" class="tsd-anchor"></a>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>v6.0.0</p>
158
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependOnceListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:902</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="rawlisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="rawlisteners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">rawListeners</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#rawlistenersk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</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>,
159
- including any wrappers (such as those created by <code>.once()</code>).</p>
160
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">emitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-3">&#39;log&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;log once&#39;</span><span class="hl-2">));</span><br/><br/><span class="hl-0">// Returns a new Array with a function `onceWrapper` which has a property</span><br/><span class="hl-0">// `listener` which contains the original listener bound above</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">listeners</span><span class="hl-2"> = </span><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">rawListeners</span><span class="hl-2">(</span><span class="hl-3">&#39;log&#39;</span><span class="hl-2">);</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">logFnWrapper</span><span class="hl-2"> = </span><span class="hl-5">listeners</span><span class="hl-2">[</span><span class="hl-8">0</span><span class="hl-2">];</span><br/><br/><span class="hl-0">// Logs &quot;log once&quot; to the console and does not unbind the `once` event</span><br/><span class="hl-5">logFnWrapper</span><span class="hl-2">.</span><span class="hl-1">listener</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// Logs &quot;log once&quot; to the console and removes the listener</span><br/><span class="hl-1">logFnWrapper</span><span class="hl-2">();</span><br/><br/><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;log&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;log persistently&#39;</span><span class="hl-2">));</span><br/><span class="hl-0">// Will return a new Array with a single function bound by `.on()` above</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">newListeners</span><span class="hl-2"> = </span><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">rawListeners</span><span class="hl-2">(</span><span class="hl-3">&#39;log&#39;</span><span class="hl-2">);</span><br/><br/><span class="hl-0">// Logs &quot;log persistently&quot; twice</span><br/><span class="hl-5">newListeners</span><span class="hl-2">[</span><span class="hl-8">0</span><span class="hl-2">]();</span><br/><span class="hl-5">emitter</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;log&#39;</span><span class="hl-2">);</span>
161
- </code><button type="button">Copy</button></pre>
162
-
163
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="rawlistenersk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-15" class="tsd-anchor"></a>Since<a href="#since-15" 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>
164
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.rawListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:818</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="removealllisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="removealllisteners-1" class="tsd-anchor"></a><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> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <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>
165
- <p>It is bad practice to remove listeners added elsewhere in the code,
166
- particularly when the <code>EventEmitter</code> instance was created by some other
167
- component or module (e.g. sockets or file streams).</p>
168
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
169
- </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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">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"><a id="since-16" class="tsd-anchor"></a>Since<a href="#since-16" 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>
170
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeAllListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:758</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="removelistener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="removelistener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">removeListener</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="NordWebSocketClient.html#removelistenerk">K</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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><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>
171
- <pre><code class="js"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">callback</span><span class="hl-2"> = (</span><span class="hl-5">stream</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;someone connected!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">};</span><br/><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, </span><span class="hl-5">callback</span><span class="hl-2">);</span><br/><span class="hl-0">// ...</span><br/><span class="hl-5">server</span><span class="hl-2">.</span><span class="hl-1">removeListener</span><span class="hl-2">(</span><span class="hl-3">&#39;connection&#39;</span><span class="hl-2">, </span><span class="hl-5">callback</span><span class="hl-2">);</span>
172
- </code><button type="button">Copy</button></pre>
173
-
174
- <p><code>removeListener()</code> will remove, at most, one instance of a listener from the
175
- listener array. If any single listener has been added multiple times to the
176
- listener array for the specified <code>eventName</code>, then <code>removeListener()</code> must be
177
- called multiple times to remove each instance.</p>
178
- <p>Once an event is emitted, all listeners attached to it at the
179
- 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
180
- will not remove them from<code>emit()</code> in progress. Subsequent events behave as expected.</p>
181
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">class</span><span class="hl-2"> </span><span class="hl-9">MyEmitter</span><span class="hl-2"> </span><span class="hl-6">extends</span><span class="hl-2"> </span><span class="hl-9">EventEmitter</span><span class="hl-2"> {}</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEmitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">MyEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">callbackA</span><span class="hl-2"> = () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;A&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">removeListener</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-5">callbackB</span><span class="hl-2">);</span><br/><span class="hl-2">};</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">callbackB</span><span class="hl-2"> = () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;B&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">};</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-5">callbackA</span><span class="hl-2">);</span><br/><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, </span><span class="hl-5">callbackB</span><span class="hl-2">);</span><br/><br/><span class="hl-0">// callbackA removes listener callbackB but it will still be called.</span><br/><span class="hl-0">// Internal listener array at time of emit [callbackA, callbackB]</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">);</span><br/><span class="hl-0">// Prints:</span><br/><span class="hl-0">// A</span><br/><span class="hl-0">// B</span><br/><br/><span class="hl-0">// callbackB is now removed.</span><br/><span class="hl-0">// Internal listener array [callbackA]</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">);</span><br/><span class="hl-0">// Prints:</span><br/><span class="hl-0">// A</span>
182
- </code><button type="button">Copy</button></pre>
183
-
184
- <p>Because listeners are managed using an internal array, calling this will
185
- change the position indices of any listener registered <em>after</em> the listener
186
- being removed. This will not impact the order in which listeners are called,
187
- but it means that any copies of the listener array as returned by
188
- the <code>emitter.listeners()</code> method will need to be recreated.</p>
189
- <p>When a single function has been added as a handler multiple times for a single
190
- event (as in the example below), <code>removeListener()</code> will remove the most
191
- recently added instance. In the example the <code>once('ping')</code> listener is removed:</p>
192
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">pong</span><span class="hl-2">() {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;pong&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;ping&#39;</span><span class="hl-2">, </span><span class="hl-5">pong</span><span class="hl-2">);</span><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-3">&#39;ping&#39;</span><span class="hl-2">, </span><span class="hl-5">pong</span><span class="hl-2">);</span><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">removeListener</span><span class="hl-2">(</span><span class="hl-3">&#39;ping&#39;</span><span class="hl-2">, </span><span class="hl-5">pong</span><span class="hl-2">);</span><br/><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;ping&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;ping&#39;</span><span class="hl-2">);</span>
193
- </code><button type="button">Copy</button></pre>
194
-
195
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
196
- </div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="removelistenerk" class="tsd-anchor"></a><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>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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"><a id="since-17" class="tsd-anchor"></a>Since<a href="#since-17" 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>
197
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:742</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="setmaxlisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="setmaxlisteners-1" class="tsd-anchor"></a><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
198
- added for a particular event. This is a useful default that helps finding
199
- memory leaks. The <code>emitter.setMaxListeners()</code> method allows the limit to be
200
- 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>
201
- <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
202
- </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"><a id="since-18" class="tsd-anchor"></a>Since<a href="#since-18" 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>
203
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:768</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="subscribe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>subscribe</span><a href="#subscribe" 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"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="subscribe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">subscribe</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">streams</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#subscribe-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>Subscribe to one or more streams</p>
204
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">streams</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Array of streams to subscribe to (e.g. [&quot;trades@BTCUSDC&quot;, &quot;deltas@BTCUSDC&quot;])</p>
205
- </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L281">src/websocket/NordWebSocketClient.ts:281</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="unsubscribe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>unsubscribe</span><a href="#unsubscribe" 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"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="unsubscribe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">unsubscribe</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">streams</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#unsubscribe-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>Unsubscribe from one or more streams</p>
206
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">streams</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Array of streams to unsubscribe from</p>
207
- </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/n1xyz/nord/blob/db1e8d9daec7392ed11d31400e5eab5107c77b3e/ts/src/websocket/NordWebSocketClient.ts#L328">src/websocket/NordWebSocketClient.ts:328</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="addabortlistener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>add<wbr/>Abort<wbr/>Listener</span><a href="#addabortlistener" 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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="addabortlistener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">addAbortListener</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">signal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AbortSignal</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">resource</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Event</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</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">Disposable</span><a href="#addabortlistener-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"><code class="tsd-tag">Experimental</code><div class="tsd-comment tsd-typography"><p>Listens once to the <code>abort</code> event on the provided <code>signal</code>.</p>
208
- <p>Listening to the <code>abort</code> event on abort signals is unsafe and may
209
- lead to resource leaks since another third party with the signal can
210
- call <code>e.stopImmediatePropagation()</code>. Unfortunately Node.js cannot change
211
- this since it would violate the web standard. Additionally, the original
212
- API makes it easy to forget to remove listeners.</p>
213
- <p>This API allows safely using <code>AbortSignal</code>s in Node.js APIs by solving these
214
- two issues by listening to the event such that <code>stopImmediatePropagation</code> does
215
- not prevent the listener from running.</p>
216
- <p>Returns a disposable so that it may be unsubscribed from more easily.</p>
217
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">addAbortListener</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">example</span><span class="hl-2">(</span><span class="hl-5">signal</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-6">let</span><span class="hl-2"> </span><span class="hl-5">disposable</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">signal</span><span class="hl-2">.</span><span class="hl-1">addEventListener</span><span class="hl-2">(</span><span class="hl-3">&#39;abort&#39;</span><span class="hl-2">, (</span><span class="hl-5">e</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">e</span><span class="hl-2">.</span><span class="hl-1">stopImmediatePropagation</span><span class="hl-2">());</span><br/><span class="hl-2"> </span><span class="hl-5">disposable</span><span class="hl-2"> = </span><span class="hl-1">addAbortListener</span><span class="hl-2">(</span><span class="hl-5">signal</span><span class="hl-2">, (</span><span class="hl-5">e</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-0">// Do something when signal is aborted.</span><br/><span class="hl-2"> });</span><br/><span class="hl-2"> } </span><span class="hl-4">finally</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">disposable</span><span class="hl-2">?.[</span><span class="hl-5">Symbol</span><span class="hl-2">.</span><span class="hl-5">dispose</span><span class="hl-2">]();</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">}</span>
218
- </code><button type="button">Copy</button></pre>
219
-
220
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signal</span>: <span class="tsd-signature-type">AbortSignal</span></span></li><li><span><span class="tsd-kind-parameter">resource</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Event</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Disposable</span></h4><p>Disposable that removes the <code>abort</code> listener.</p>
221
- <div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-19" class="tsd-anchor"></a>Since<a href="#since-19" 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>v20.5.0</p>
222
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addAbortListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:437</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="geteventlisteners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>get<wbr/>Event<wbr/>Listeners</span><a href="#geteventlisteners" 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-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="geteventlisteners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getEventListeners</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">name</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><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span><a href="#geteventlisteners-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>
223
- <p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.listeners</code> on
224
- the emitter.</p>
225
- <p>For <code>EventTarget</code>s this is the only way to get the event listeners for the
226
- event target. This is useful for debugging and diagnostic purposes.</p>
227
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">getEventListeners</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-2">{</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">listener</span><span class="hl-2"> = () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;Events are fun&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-5">listener</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getEventListeners</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">)); </span><span class="hl-0">// [ [Function: listener] ]</span><br/><span class="hl-2">}</span><br/><span class="hl-2">{</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">et</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventTarget</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">listener</span><span class="hl-2"> = () </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;Events are fun&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">et</span><span class="hl-2">.</span><span class="hl-1">addEventListener</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-5">listener</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getEventListeners</span><span class="hl-2">(</span><span class="hl-5">et</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">)); </span><span class="hl-0">// [ [Function: listener] ]</span><br/><span class="hl-2">}</span>
228
- </code><button type="button">Copy</button></pre>
229
-
230
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-20" class="tsd-anchor"></a>Since<a href="#since-20" 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>v15.2.0, v14.17.0</p>
231
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getEventListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:358</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="getmaxlisteners-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>get<wbr/>Max<wbr/>Listeners</span><a href="#getmaxlisteners-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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="getmaxlisteners-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getMaxListeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getmaxlisteners-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the currently set max amount of listeners.</p>
232
- <p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.getMaxListeners</code> on
233
- the emitter.</p>
234
- <p>For <code>EventTarget</code>s this is the only way to get the max event listeners for the
235
- event target. If the number of event handlers on a single EventTarget exceeds
236
- the max set, the EventTarget will print a warning.</p>
237
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">getMaxListeners</span><span class="hl-2">, </span><span class="hl-5">setMaxListeners</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-2">{</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getMaxListeners</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">)); </span><span class="hl-0">// 10</span><br/><span class="hl-2"> </span><span class="hl-1">setMaxListeners</span><span class="hl-2">(</span><span class="hl-8">11</span><span class="hl-2">, </span><span class="hl-5">ee</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getMaxListeners</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">)); </span><span class="hl-0">// 11</span><br/><span class="hl-2">}</span><br/><span class="hl-2">{</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">et</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventTarget</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getMaxListeners</span><span class="hl-2">(</span><span class="hl-5">et</span><span class="hl-2">)); </span><span class="hl-0">// 10</span><br/><span class="hl-2"> </span><span class="hl-1">setMaxListeners</span><span class="hl-2">(</span><span class="hl-8">11</span><span class="hl-2">, </span><span class="hl-5">et</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">getMaxListeners</span><span class="hl-2">(</span><span class="hl-5">et</span><span class="hl-2">)); </span><span class="hl-0">// 11</span><br/><span class="hl-2">}</span>
238
- </code><button type="button">Copy</button></pre>
239
-
240
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</span></span></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"><a id="since-21" class="tsd-anchor"></a>Since<a href="#since-21" 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>v19.9.0</p>
241
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:387</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listenercount-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span class="deprecated">listener<wbr/>Count</span><a href="#listenercount-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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="listenercount-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listenerCount</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#listenercount-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>A class method that returns the number of listeners for the given <code>eventName</code> registered on the given <code>emitter</code>.</p>
242
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2">, </span><span class="hl-5">listenerCount</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">myEmitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {});</span><br/><span class="hl-5">myEmitter</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">, () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {});</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-1">listenerCount</span><span class="hl-2">(</span><span class="hl-5">myEmitter</span><span class="hl-2">, </span><span class="hl-3">&#39;event&#39;</span><span class="hl-2">));</span><br/><span class="hl-0">// Prints: 2</span>
243
- </code><button type="button">Copy</button></pre>
244
-
245
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span></span><div class="tsd-comment tsd-typography"><p>The emitter to query</p>
246
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The event name</p>
247
- </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"><a id="since-22" class="tsd-anchor"></a>Since<a href="#since-22" 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.9.12</p>
248
- </div><div class="tsd-tag-deprecated"><h4 class="tsd-anchor-link"><a id="deprecated" class="tsd-anchor"></a>Deprecated<a href="#deprecated" 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>Since v3.2.0 - Use <code>listenerCount</code> instead.</p>
249
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:330</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="on-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>on</span><a href="#on-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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="on-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">StaticEventEmitterIteratorOptions</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">AsyncIterator</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><a href="#on-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// Emit later on</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">)) {</span><br/><span class="hl-2"> </span><span class="hl-0">// The execution of this inner block is synchronous and it</span><br/><span class="hl-2"> </span><span class="hl-0">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-2"> </span><span class="hl-0">// if concurrent execution is required.</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2">}</span><br/><span class="hl-0">// Unreachable here</span>
250
- </code><button type="button">Copy</button></pre>
251
-
252
- <p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
253
- if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
254
- exiting the loop. The <code>value</code> returned by each iteration is an array
255
- composed of the emitted event arguments.</p>
256
- <p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
257
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ac</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">AbortController</span><span class="hl-2">();</span><br/><br/><span class="hl-2">(</span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-2"> </span><span class="hl-0">// Emit later on</span><br/><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2"> });</span><br/><br/><span class="hl-2"> </span><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, { </span><span class="hl-5">signal:</span><span class="hl-2"> </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-5">signal</span><span class="hl-2"> })) {</span><br/><span class="hl-2"> </span><span class="hl-0">// The execution of this inner block is synchronous and it</span><br/><span class="hl-2"> </span><span class="hl-0">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-2"> </span><span class="hl-0">// if concurrent execution is required.</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> </span><span class="hl-0">// Unreachable here</span><br/><span class="hl-2">})();</span><br/><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-1">abort</span><span class="hl-2">());</span>
258
- </code><button type="button">Copy</button></pre>
259
-
260
- <p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
261
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// Emit later on</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;close&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, { </span><span class="hl-5">close:</span><span class="hl-2"> [</span><span class="hl-3">&#39;close&#39;</span><span class="hl-2">] })) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2">}</span><br/><span class="hl-0">// the loop will exit after &#39;close&#39; is emitted</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;done&#39;</span><span class="hl-2">); </span><span class="hl-0">// prints &#39;done&#39;</span>
262
- </code><button type="button">Copy</button></pre>
263
-
264
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">StaticEventEmitterIteratorOptions</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncIterator</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
265
- <div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-23" class="tsd-anchor"></a>Since<a href="#since-23" 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>v13.6.0, v12.16.0</p>
266
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:303</li></ul></aside></div></li><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="on-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventTarget</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">StaticEventEmitterIteratorOptions</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">AsyncIterator</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><a href="#on-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// Emit later on</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">)) {</span><br/><span class="hl-2"> </span><span class="hl-0">// The execution of this inner block is synchronous and it</span><br/><span class="hl-2"> </span><span class="hl-0">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-2"> </span><span class="hl-0">// if concurrent execution is required.</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2">}</span><br/><span class="hl-0">// Unreachable here</span>
267
- </code><button type="button">Copy</button></pre>
268
-
269
- <p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
270
- if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
271
- exiting the loop. The <code>value</code> returned by each iteration is an array
272
- composed of the emitted event arguments.</p>
273
- <p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
274
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ac</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">AbortController</span><span class="hl-2">();</span><br/><br/><span class="hl-2">(</span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-2"> </span><span class="hl-0">// Emit later on</span><br/><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2"> });</span><br/><br/><span class="hl-2"> </span><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, { </span><span class="hl-5">signal:</span><span class="hl-2"> </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-5">signal</span><span class="hl-2"> })) {</span><br/><span class="hl-2"> </span><span class="hl-0">// The execution of this inner block is synchronous and it</span><br/><span class="hl-2"> </span><span class="hl-0">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-2"> </span><span class="hl-0">// if concurrent execution is required.</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> </span><span class="hl-0">// Unreachable here</span><br/><span class="hl-2">})();</span><br/><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-1">abort</span><span class="hl-2">());</span>
275
- </code><button type="button">Copy</button></pre>
276
-
277
- <p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
278
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">on</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// Emit later on</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-3">&#39;bar&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;close&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">for</span><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">event</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, { </span><span class="hl-5">close:</span><span class="hl-2"> [</span><span class="hl-3">&#39;close&#39;</span><span class="hl-2">] })) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">event</span><span class="hl-2">); </span><span class="hl-0">// prints [&#39;bar&#39;] [42]</span><br/><span class="hl-2">}</span><br/><span class="hl-0">// the loop will exit after &#39;close&#39; is emitted</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;done&#39;</span><span class="hl-2">); </span><span class="hl-0">// prints &#39;done&#39;</span>
279
- </code><button type="button">Copy</button></pre>
280
-
281
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">StaticEventEmitterIteratorOptions</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncIterator</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
282
- <div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-24" class="tsd-anchor"></a>Since<a href="#since-24" 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>v13.6.0, v12.16.0</p>
283
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:308</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="once-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>once</span><a href="#once-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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="once-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">eventName</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><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">StaticEventEmitterOptions</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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><a href="#once-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a <code>Promise</code> that is fulfilled when the <code>EventEmitter</code> emits the given
284
- event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
285
- The <code>Promise</code> will resolve with an array of all the arguments emitted to the
286
- given event.</p>
287
- <p>This method is intentionally generic and works with the web platform <a href="https://dom.spec.whatwg.org/#interface-eventtarget">EventTarget</a> interface, which has no special<code>'error'</code> event
288
- semantics and does not listen to the <code>'error'</code> event.</p>
289
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">once</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> [</span><span class="hl-7">value</span><span class="hl-2">] = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">value</span><span class="hl-2">);</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">err</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Error</span><span class="hl-2">(</span><span class="hl-3">&#39;kaboom&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">} </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">err</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;error happened&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">);</span><br/><span class="hl-2">}</span>
290
- </code><button type="button">Copy</button></pre>
291
-
292
- <p>The special handling of the <code>'error'</code> event is only used when <code>events.once()</code> is used to wait for another event. If <code>events.once()</code> is used to wait for the
293
- '<code>error'</code> event itself, then it is treated as any other kind of event without
294
- special handling:</p>
295
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2">, </span><span class="hl-5">once</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">)</span><br/><span class="hl-2"> .</span><span class="hl-1">then</span><span class="hl-2">(([</span><span class="hl-5">err</span><span class="hl-2">]) </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;ok&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">))</span><br/><span class="hl-2"> .</span><span class="hl-1">catch</span><span class="hl-2">((</span><span class="hl-5">err</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">));</span><br/><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Error</span><span class="hl-2">(</span><span class="hl-3">&#39;boom&#39;</span><span class="hl-2">));</span><br/><br/><span class="hl-0">// Prints: ok boom</span>
296
- </code><button type="button">Copy</button></pre>
297
-
298
- <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
299
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2">, </span><span class="hl-5">once</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ac</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">AbortController</span><span class="hl-2">();</span><br/><br/><span class="hl-6">async</span><span class="hl-2"> </span><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">foo</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">, </span><span class="hl-5">event</span><span class="hl-2">, </span><span class="hl-5">signal</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">, </span><span class="hl-5">event</span><span class="hl-2">, { </span><span class="hl-5">signal</span><span class="hl-2"> });</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;event emitted!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">.</span><span class="hl-5">name</span><span class="hl-2"> === </span><span class="hl-3">&#39;AbortError&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;Waiting for the event was canceled!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;There was an error&#39;</span><span class="hl-2">, </span><span class="hl-5">error</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-1">foo</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-5">signal</span><span class="hl-2">);</span><br/><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-1">abort</span><span class="hl-2">(); </span><span class="hl-0">// Abort waiting for the event</span><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">); </span><span class="hl-0">// Prints: Waiting for the event was canceled!</span>
300
- </code><button type="button">Copy</button></pre>
301
-
302
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">StaticEventEmitterOptions</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-25" class="tsd-anchor"></a>Since<a href="#since-25" 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>v11.13.0, v10.16.0</p>
303
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:217</li></ul></aside></div></li><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="once-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventTarget</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">StaticEventEmitterOptions</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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><a href="#once-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a <code>Promise</code> that is fulfilled when the <code>EventEmitter</code> emits the given
304
- event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
305
- The <code>Promise</code> will resolve with an array of all the arguments emitted to the
306
- given event.</p>
307
- <p>This method is intentionally generic and works with the web platform <a href="https://dom.spec.whatwg.org/#interface-eventtarget">EventTarget</a> interface, which has no special<code>'error'</code> event
308
- semantics and does not listen to the <code>'error'</code> event.</p>
309
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">once</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">process</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:process&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">, </span><span class="hl-8">42</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> [</span><span class="hl-7">value</span><span class="hl-2">] = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">value</span><span class="hl-2">);</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">err</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Error</span><span class="hl-2">(</span><span class="hl-3">&#39;kaboom&#39;</span><span class="hl-2">);</span><br/><span class="hl-5">process</span><span class="hl-2">.</span><span class="hl-1">nextTick</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">);</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;myevent&#39;</span><span class="hl-2">);</span><br/><span class="hl-2">} </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">err</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;error happened&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">);</span><br/><span class="hl-2">}</span>
310
- </code><button type="button">Copy</button></pre>
311
-
312
- <p>The special handling of the <code>'error'</code> event is only used when <code>events.once()</code> is used to wait for another event. If <code>events.once()</code> is used to wait for the
313
- '<code>error'</code> event itself, then it is treated as any other kind of event without
314
- special handling:</p>
315
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2">, </span><span class="hl-5">once</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">)</span><br/><span class="hl-2"> .</span><span class="hl-1">then</span><span class="hl-2">(([</span><span class="hl-5">err</span><span class="hl-2">]) </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;ok&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">))</span><br/><span class="hl-2"> .</span><span class="hl-1">catch</span><span class="hl-2">((</span><span class="hl-5">err</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-5">err</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">));</span><br/><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-2">, </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Error</span><span class="hl-2">(</span><span class="hl-3">&#39;boom&#39;</span><span class="hl-2">));</span><br/><br/><span class="hl-0">// Prints: ok boom</span>
316
- </code><button type="button">Copy</button></pre>
317
-
318
- <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
319
- <pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">EventEmitter</span><span class="hl-2">, </span><span class="hl-5">once</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ee</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">ac</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">AbortController</span><span class="hl-2">();</span><br/><br/><span class="hl-6">async</span><span class="hl-2"> </span><span class="hl-6">function</span><span class="hl-2"> </span><span class="hl-1">foo</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">, </span><span class="hl-5">event</span><span class="hl-2">, </span><span class="hl-5">signal</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">once</span><span class="hl-2">(</span><span class="hl-5">emitter</span><span class="hl-2">, </span><span class="hl-5">event</span><span class="hl-2">, { </span><span class="hl-5">signal</span><span class="hl-2"> });</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;event emitted!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">.</span><span class="hl-5">name</span><span class="hl-2"> === </span><span class="hl-3">&#39;AbortError&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;Waiting for the event was canceled!&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;There was an error&#39;</span><span class="hl-2">, </span><span class="hl-5">error</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-1">foo</span><span class="hl-2">(</span><span class="hl-5">ee</span><span class="hl-2">, </span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">, </span><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-5">signal</span><span class="hl-2">);</span><br/><span class="hl-5">ac</span><span class="hl-2">.</span><span class="hl-1">abort</span><span class="hl-2">(); </span><span class="hl-0">// Abort waiting for the event</span><br/><span class="hl-5">ee</span><span class="hl-2">.</span><span class="hl-1">emit</span><span class="hl-2">(</span><span class="hl-3">&#39;foo&#39;</span><span class="hl-2">); </span><span class="hl-0">// Prints: Waiting for the event was canceled!</span>
320
- </code><button type="button">Copy</button></pre>
321
-
322
- </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">StaticEventEmitterOptions</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-26" class="tsd-anchor"></a>Since<a href="#since-26" 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>v11.13.0, v10.16.0</p>
323
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:222</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="setmaxlisteners-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>set<wbr/>Max<wbr/>Listeners</span><a href="#setmaxlisteners-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></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link"><a id="setmaxlisteners-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setMaxListeners</span><span class="tsd-signature-symbol">(</span><br/>    <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><br/>    <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">eventTargets</span><span class="tsd-signature-symbol">:</span> (<span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</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">void</span><a href="#setmaxlisteners-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></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><pre><code class="js"><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">setMaxListeners</span><span class="hl-2">, </span><span class="hl-5">EventEmitter</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;node:events&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">target</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventTarget</span><span class="hl-2">();</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">emitter</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">EventEmitter</span><span class="hl-2">();</span><br/><br/><span class="hl-1">setMaxListeners</span><span class="hl-2">(</span><span class="hl-8">5</span><span class="hl-2">, </span><span class="hl-5">target</span><span class="hl-2">, </span><span class="hl-5">emitter</span><span class="hl-2">);</span>
324
- </code><button type="button">Copy</button></pre>
325
-
326
- </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">n</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p>
327
- </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">eventTargets</span>: (<span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">&gt;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventTarget</span>)<span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, <code>n</code> is set as the default max for all newly created {EventTarget} and {EventEmitter}
328
- objects.</p>
329
- </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"><a id="since-27" class="tsd-anchor"></a>Since<a href="#since-27" 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>v15.4.0</p>
330
- </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.30/node_modules/@types/node/events.d.ts:402</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"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>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"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>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-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#capturerejections" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejections</span></a><a href="#capturerejectionsymbol" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejection<wbr/>Symbol</span></a><a href="#defaultmaxlisteners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>default<wbr/>Max<wbr/>Listeners</span></a><a href="#errormonitor" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>error<wbr/>Monitor</span></a></div></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-1" class="tsd-is-inherited 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-inherited 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="#close" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>close</span></a><a href="#connect" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>connect</span></a><a href="#emit" class="tsd-is-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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-inherited 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><a href="#subscribe" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>subscribe</span></a><a href="#unsubscribe" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unsubscribe</span></a><a href="#addabortlistener" class="tsd-is-inherited 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/>Abort<wbr/>Listener</span></a><a href="#geteventlisteners" class="tsd-is-inherited 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/>Event<wbr/>Listeners</span></a><a href="#getmaxlisteners-2" class="tsd-is-inherited 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-2" class="tsd-is-inherited 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="#on-2" class="tsd-is-inherited 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-2" class="tsd-is-inherited 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="#setmaxlisteners-2" class="tsd-is-inherited 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">@n1xyz/nord-ts</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>