@n1xyz/nord-ts 0.0.4 → 0.0.7

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 (306) hide show
  1. package/dist/bridge/client.d.ts +4 -4
  2. package/dist/bridge/client.js +4 -4
  3. package/dist/bridge/const.d.ts +2 -2
  4. package/dist/bridge/const.js +22 -22
  5. package/dist/bridge/index.d.ts +4 -4
  6. package/dist/bridge/types.d.ts +3 -3
  7. package/dist/bridge/utils.d.ts +4 -4
  8. package/dist/bridge/utils.js +10 -10
  9. package/dist/const.d.ts +1 -1
  10. package/dist/const.js +17 -17
  11. package/dist/gen/nord.d.ts +1 -4
  12. package/dist/idl/bridge.d.ts +1 -1
  13. package/dist/idl/bridge.js +185 -185
  14. package/dist/index.d.ts +8 -8
  15. package/dist/nord/api/actions.d.ts +3 -3
  16. package/dist/nord/api/actions.js +21 -21
  17. package/dist/nord/api/core.d.ts +3 -3
  18. package/dist/nord/api/core.js +12 -12
  19. package/dist/nord/api/market.d.ts +1 -1
  20. package/dist/nord/api/market.js +12 -12
  21. package/dist/nord/api/metrics.d.ts +1 -1
  22. package/dist/nord/api/metrics.js +6 -6
  23. package/dist/nord/api/queries.d.ts +1 -1
  24. package/dist/nord/api/queries.js +9 -9
  25. package/dist/nord/client/Nord.d.ts +4 -4
  26. package/dist/nord/client/Nord.js +18 -18
  27. package/dist/nord/client/NordUser.d.ts +7 -7
  28. package/dist/nord/client/NordUser.js +45 -49
  29. package/dist/nord/index.d.ts +9 -9
  30. package/dist/nord/models/Subscriber.d.ts +6 -6
  31. package/dist/nord/models/Subscriber.js +1 -5
  32. package/dist/nord/utils/NordError.js +2 -2
  33. package/dist/types.d.ts +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/utils.d.ts +6 -6
  36. package/dist/utils.js +8 -8
  37. package/dist/websocket/NordWebSocketClient.d.ts +2 -2
  38. package/dist/websocket/NordWebSocketClient.js +38 -38
  39. package/dist/websocket/events.d.ts +1 -1
  40. package/dist/websocket/index.d.ts +2 -2
  41. package/docs/assets/hierarchy.js +1 -0
  42. package/docs/assets/highlight.css +16 -16
  43. package/docs/assets/icons.js +17 -14
  44. package/docs/assets/icons.svg +1 -1
  45. package/docs/assets/main.js +5 -4
  46. package/docs/assets/navigation.js +1 -1
  47. package/docs/assets/search.js +1 -1
  48. package/docs/assets/style.css +1423 -1227
  49. package/docs/classes/Nord.html +190 -31
  50. package/docs/classes/NordError.html +24 -0
  51. package/docs/classes/NordUser.html +120 -35
  52. package/docs/classes/NordWebSocketClient.html +335 -0
  53. package/docs/classes/SolanaBridgeClient.html +86 -0
  54. package/docs/classes/Subscriber.html +10 -0
  55. package/docs/enums/FillMode.html +5 -5
  56. package/docs/enums/KeyType.html +4 -4
  57. package/docs/enums/MetricPeriod.html +9 -0
  58. package/docs/enums/PdaSeedType.html +9 -0
  59. package/docs/enums/PeakTpsPeriodUnit.html +7 -7
  60. package/docs/enums/Side.html +3 -3
  61. package/docs/enums/WebSocketMessageType.html +7 -0
  62. package/docs/functions/actionQueryRollman.html +6 -0
  63. package/docs/functions/actionsQueryRollman.html +6 -0
  64. package/docs/functions/aggregateMetrics-1.html +7 -0
  65. package/docs/functions/assert.html +1 -1
  66. package/docs/functions/bigIntToProtoU128.html +3 -3
  67. package/docs/functions/blockQueryRollman.html +6 -0
  68. package/docs/functions/blockSummaryQueryRollman.html +6 -0
  69. package/docs/functions/bridgeToBN.html +5 -0
  70. package/docs/functions/bufferToHex.html +4 -0
  71. package/docs/functions/cancelOrder.html +1 -0
  72. package/docs/functions/checkPubKeyLength.html +1 -1
  73. package/docs/functions/checkedFetch.html +4 -4
  74. package/docs/functions/createSession.html +1 -0
  75. package/docs/functions/decodeLengthDelimited.html +7 -6
  76. package/docs/functions/encodeLengthDelimited.html +4 -4
  77. package/docs/functions/fillModeToProtoFillMode.html +4 -4
  78. package/docs/functions/findMarket.html +1 -1
  79. package/docs/functions/findPda.html +6 -0
  80. package/docs/functions/findToken.html +1 -1
  81. package/docs/functions/fromBN.html +5 -0
  82. package/docs/functions/getAccount.html +6 -0
  83. package/docs/functions/getActionNonce.html +5 -0
  84. package/docs/functions/getCurrentTps.html +6 -0
  85. package/docs/functions/getInfo.html +5 -0
  86. package/docs/functions/getMedianLatency.html +6 -0
  87. package/docs/functions/getOrderbook.html +6 -0
  88. package/docs/functions/getPeakTps.html +6 -0
  89. package/docs/functions/getTimestamp.html +5 -0
  90. package/docs/functions/getTotalTransactions.html +5 -0
  91. package/docs/functions/getTrades.html +6 -0
  92. package/docs/functions/getUserAccountIds.html +6 -0
  93. package/docs/functions/hexToBuffer.html +4 -0
  94. package/docs/functions/initWebSocketClient.html +12 -0
  95. package/docs/functions/keypairFromPrivateKey.html +4 -0
  96. package/docs/functions/makeSigningFunction.html +4 -0
  97. package/docs/functions/makeWalletSignFn.html +5 -5
  98. package/docs/functions/marketsStats.html +5 -0
  99. package/docs/functions/optExpect.html +4 -4
  100. package/docs/functions/optMap.html +5 -5
  101. package/docs/functions/optUnwrap.html +2 -2
  102. package/docs/functions/panic.html +1 -1
  103. package/docs/functions/placeOrder.html +1 -0
  104. package/docs/functions/queryAction.html +6 -0
  105. package/docs/functions/queryBlock.html +6 -0
  106. package/docs/functions/queryLastNBlocks.html +5 -0
  107. package/docs/functions/queryPrometheus.html +6 -0
  108. package/docs/functions/queryRecentActions.html +6 -0
  109. package/docs/functions/queryRecentBlocks.html +6 -0
  110. package/docs/functions/revokeSession.html +1 -0
  111. package/docs/functions/shortenPublicKey.html +5 -0
  112. package/docs/functions/signAction.html +2 -2
  113. package/docs/functions/toBN.html +5 -0
  114. package/docs/functions/toScaledU128.html +5 -5
  115. package/docs/functions/toScaledU64.html +5 -5
  116. package/docs/functions/transfer.html +1 -0
  117. package/docs/functions/withdraw.html +1 -0
  118. package/docs/hierarchy.html +1 -0
  119. package/docs/index.html +39 -20
  120. package/docs/interfaces/Account.html +8 -8
  121. package/docs/interfaces/ActionInfo.html +8 -8
  122. package/docs/interfaces/ActionNonceResponse.html +3 -0
  123. package/docs/interfaces/ActionQuery.html +4 -4
  124. package/docs/interfaces/ActionResponse.html +8 -8
  125. package/docs/interfaces/ActionsExtendedInfo.html +10 -10
  126. package/docs/interfaces/ActionsQuery.html +5 -5
  127. package/docs/interfaces/ActionsResponse.html +6 -6
  128. package/docs/interfaces/AggregateMetrics.html +12 -12
  129. package/docs/interfaces/BlockFacts.html +10 -0
  130. package/docs/interfaces/BlockQuery.html +6 -6
  131. package/docs/interfaces/BlockResponse.html +6 -6
  132. package/docs/interfaces/BlockSummary.html +8 -8
  133. package/docs/interfaces/BlockSummaryResponse.html +6 -6
  134. package/docs/interfaces/DeltaEvent.html +6 -6
  135. package/docs/interfaces/DepositSplParams.html +10 -0
  136. package/docs/interfaces/Info.html +3 -3
  137. package/docs/interfaces/Market.html +8 -6
  138. package/docs/interfaces/MarketStats.html +7 -7
  139. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  140. package/docs/interfaces/NordConfig.html +14 -5
  141. package/docs/interfaces/NordWebSocketClientEvents.html +4 -0
  142. package/docs/interfaces/NordWebSocketEvents.html +8 -0
  143. package/docs/interfaces/Order.html +6 -6
  144. package/docs/interfaces/OrderInfo.html +6 -6
  145. package/docs/interfaces/OrderbookEntry.html +4 -0
  146. package/docs/interfaces/OrderbookQuery.html +6 -0
  147. package/docs/interfaces/OrderbookResponse.html +6 -0
  148. package/docs/interfaces/OrderbookSubscription.html +159 -0
  149. package/docs/interfaces/PerpMarketStats.html +5 -5
  150. package/docs/interfaces/RollmanActionExtendedInfo.html +4 -4
  151. package/docs/interfaces/RollmanActionInfo.html +4 -4
  152. package/docs/interfaces/RollmanActionResponse.html +4 -4
  153. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  154. package/docs/interfaces/RollmanBlockResponse.html +3 -3
  155. package/docs/interfaces/SPLTokenInfo.html +10 -0
  156. package/docs/interfaces/SolanaBridgeConfig.html +10 -0
  157. package/docs/interfaces/StateFacts.html +10 -0
  158. package/docs/interfaces/SubscriberConfig.html +3 -3
  159. package/docs/interfaces/TimestampResponse.html +3 -0
  160. package/docs/interfaces/Token.html +5 -5
  161. package/docs/interfaces/TokenInfo.html +5 -0
  162. package/docs/interfaces/Trade.html +5 -5
  163. package/docs/interfaces/TradeSubscription.html +159 -0
  164. package/docs/interfaces/Trades.html +5 -5
  165. package/docs/interfaces/TradesQuery.html +6 -0
  166. package/docs/interfaces/TradesResponse.html +7 -0
  167. package/docs/interfaces/TransferParams.html +8 -0
  168. package/docs/interfaces/UserAccountIdsQuery.html +3 -0
  169. package/docs/interfaces/UserAccountIdsResponse.html +3 -0
  170. package/docs/interfaces/WebSocketDeltaUpdate.html +9 -0
  171. package/docs/interfaces/WebSocketSubscription.html +4 -0
  172. package/docs/interfaces/WebSocketTradeUpdate.html +6 -0
  173. package/docs/interfaces/WebSocketUserUpdate.html +6 -0
  174. package/docs/interfaces/WithdrawalClaim.html +14 -0
  175. package/docs/interfaces/WithdrawalParams.html +8 -0
  176. package/docs/modules.html +1 -70
  177. package/docs/types/BigIntValue.html +2 -2
  178. package/docs/types/WebSocketMessage.html +1 -0
  179. package/docs/variables/DEBUG_KEYS.html +1 -1
  180. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  181. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  182. package/docs/variables/DEV_URL.html +1 -1
  183. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  184. package/docs/variables/SESSION_TTL.html +1 -1
  185. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  186. package/docs/variables/ZERO_DECIMAL.html +1 -1
  187. package/docs/variables/_private.html +2 -0
  188. package/eslint.config.mjs +66 -0
  189. package/package.json +12 -13
  190. package/src/bridge/client.ts +10 -10
  191. package/src/bridge/const.ts +24 -24
  192. package/src/bridge/index.ts +4 -4
  193. package/src/bridge/types.ts +10 -10
  194. package/src/bridge/utils.ts +14 -14
  195. package/src/const.ts +18 -18
  196. package/src/gen/nord.ts +1 -4
  197. package/src/idl/bridge.ts +186 -186
  198. package/src/index.ts +8 -8
  199. package/src/nord/api/actions.ts +25 -25
  200. package/src/nord/api/core.ts +16 -16
  201. package/src/nord/api/market.ts +15 -15
  202. package/src/nord/api/metrics.ts +129 -22
  203. package/src/nord/api/queries.ts +12 -12
  204. package/src/nord/client/Nord.ts +27 -27
  205. package/src/nord/client/NordUser.ts +59 -63
  206. package/src/nord/index.ts +9 -9
  207. package/src/nord/models/Subscriber.ts +11 -12
  208. package/src/nord/utils/NordError.ts +2 -2
  209. package/src/types.ts +12 -12
  210. package/src/utils.ts +20 -20
  211. package/src/websocket/NordWebSocketClient.ts +42 -42
  212. package/src/websocket/events.ts +1 -1
  213. package/src/websocket/index.ts +2 -2
  214. package/tests/utils.spec.ts +24 -24
  215. package/tsconfig.eslint.json +12 -0
  216. package/.eslintignore +0 -1
  217. package/.eslintrc.js +0 -31
  218. package/dist/abis/ERC20_ABI.d.ts +0 -39
  219. package/dist/abis/ERC20_ABI.js +0 -313
  220. package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +0 -34
  221. package/dist/abis/NORD_GETTERS_FACET_ABI.js +0 -195
  222. package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +0 -35
  223. package/dist/abis/NORD_RAMP_FACET_ABI.js +0 -144
  224. package/dist/abis/index.d.ts +0 -3
  225. package/dist/abis/index.js +0 -9
  226. package/dist/bridge/NordUser.d.ts +0 -78
  227. package/dist/bridge/NordUser.js +0 -196
  228. package/dist/client.d.ts +0 -70
  229. package/dist/client.js +0 -129
  230. package/dist/constants/endpoints.d.ts +0 -65
  231. package/dist/constants/endpoints.js +0 -68
  232. package/dist/models/account.d.ts +0 -58
  233. package/dist/models/account.js +0 -6
  234. package/dist/models/index.d.ts +0 -8
  235. package/dist/models/index.js +0 -28
  236. package/dist/models/market.d.ts +0 -137
  237. package/dist/models/market.js +0 -6
  238. package/dist/models/order.d.ts +0 -211
  239. package/dist/models/order.js +0 -6
  240. package/dist/models/token.d.ts +0 -50
  241. package/dist/models/token.js +0 -6
  242. package/dist/nord/Nord.d.ts +0 -249
  243. package/dist/nord/Nord.js +0 -388
  244. package/dist/nord/NordError.d.ts +0 -23
  245. package/dist/nord/NordError.js +0 -48
  246. package/dist/nord/NordImpl.d.ts +0 -11
  247. package/dist/nord/NordImpl.js +0 -26
  248. package/dist/nord/NordUser.d.ts +0 -243
  249. package/dist/nord/NordUser.js +0 -481
  250. package/dist/nord/Subscriber.d.ts +0 -37
  251. package/dist/nord/Subscriber.js +0 -29
  252. package/dist/nord/actions.d.ts +0 -101
  253. package/dist/nord/actions.js +0 -254
  254. package/dist/nord/api/index.d.ts +0 -1
  255. package/dist/nord/api/index.js +0 -17
  256. package/dist/nord/api/orderFunctions.d.ts +0 -168
  257. package/dist/nord/api/orderFunctions.js +0 -133
  258. package/dist/nord/core.d.ts +0 -48
  259. package/dist/nord/core.js +0 -97
  260. package/dist/nord/market.d.ts +0 -36
  261. package/dist/nord/market.js +0 -90
  262. package/dist/nord/metrics.d.ts +0 -67
  263. package/dist/nord/metrics.js +0 -124
  264. package/dist/nord/queries.d.ts +0 -81
  265. package/dist/nord/queries.js +0 -181
  266. package/dist/nord/types.d.ts +0 -88
  267. package/dist/nord/types.js +0 -2
  268. package/dist/nord/websocket.d.ts +0 -49
  269. package/dist/nord/websocket.js +0 -107
  270. package/dist/operations/account.d.ts +0 -58
  271. package/dist/operations/account.js +0 -112
  272. package/dist/operations/market.d.ts +0 -65
  273. package/dist/operations/market.js +0 -131
  274. package/dist/operations/orders.d.ts +0 -57
  275. package/dist/operations/orders.js +0 -129
  276. package/dist/solana/NordUser.d.ts +0 -78
  277. package/dist/solana/NordUser.js +0 -196
  278. package/dist/solana/client.d.ts +0 -139
  279. package/dist/solana/client.js +0 -360
  280. package/dist/solana/const.d.ts +0 -23
  281. package/dist/solana/const.js +0 -47
  282. package/dist/solana/index.d.ts +0 -5
  283. package/dist/solana/index.js +0 -23
  284. package/dist/solana/types.d.ts +0 -118
  285. package/dist/solana/types.js +0 -16
  286. package/dist/solana/utils.d.ts +0 -64
  287. package/dist/solana/utils.js +0 -131
  288. package/dist/types/api.d.ts +0 -152
  289. package/dist/types/api.js +0 -6
  290. package/dist/types/config.d.ts +0 -34
  291. package/dist/types/config.js +0 -6
  292. package/dist/utils/errors.d.ts +0 -96
  293. package/dist/utils/errors.js +0 -132
  294. package/dist/utils/http.d.ts +0 -35
  295. package/dist/utils/http.js +0 -105
  296. package/dist/websocket/client.d.ts +0 -93
  297. package/dist/websocket/client.js +0 -222
  298. package/dist/websocket.d.ts +0 -55
  299. package/dist/websocket.js +0 -211
  300. package/docs/interfaces/ERC20TokenInfo.html +0 -5
  301. package/docs/variables/DEV_CONTRACT_ADDRESS.html +0 -1
  302. package/docs/variables/ERC20_ABI.html +0 -1
  303. package/docs/variables/EVM_DEV_URL.html +0 -1
  304. package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +0 -1
  305. package/docs/variables/NORD_GETTERS_FACET_ABI.html +0 -1
  306. package/docs/variables/NORD_RAMP_FACET_ABI.html +0 -1
@@ -0,0 +1,335 @@
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
+ <ul>
4
+ <li>/ws/trades - For trade updates</li>
5
+ <li>/ws/deltas - For orderbook delta updates</li>
6
+ <li>/ws/user - For user-specific updates</li>
7
+ </ul>
8
+ <p>Each endpoint handles a specific type of data and subscriptions must match
9
+ the endpoint type (e.g., only 'trades@BTCUSDC' subscriptions are valid on
10
+ the /ws/trades endpoint).</p>
11
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-hierarchy" data-refl="1134"><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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L47">src/websocket/NordWebSocketClient.ts:47</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>
12
+ </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>
13
+ <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>
14
+ <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>
15
+ <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>
16
+ </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>
17
+ <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>
18
+ <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>
19
+ <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>
20
+ <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>
21
+ <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>
22
+ <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>
23
+ <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>
24
+ <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>
25
+ <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>
26
+ <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>
27
+ <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>
28
+ <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>
29
+ <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>
30
+ <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>
31
+ <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>
32
+ <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>
33
+ <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>
34
+ <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>
35
+ <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>
36
+ <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>
37
+ <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>
38
+ <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>
39
+ <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>
40
+ <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>
41
+ <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>
42
+ <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>
43
+ </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>
44
+ </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>
45
+ </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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L65">src/websocket/NordWebSocketClient.ts:65</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>
46
+ <p>Change the default <code>captureRejections</code> option on all new <code>EventEmitter</code> objects.</p>
47
+ </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>
48
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejections</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
49
+ <p>See how to write a custom <code>rejection handler</code>.</p>
50
+ </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>
51
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejectionSymbol</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
52
+ event. This limit can be changed for individual <code>EventEmitter</code> instances
53
+ using the <code>emitter.setMaxListeners(n)</code> method. To change the default
54
+ for <em>all</em><code>EventEmitter</code> instances, the <code>events.defaultMaxListeners</code> property
55
+ can be used. If this value is not a positive number, a <code>RangeError</code> is thrown.</p>
56
+ <p>Take caution when setting the <code>events.defaultMaxListeners</code> because the
57
+ change affects <em>all</em> <code>EventEmitter</code> instances, including those created before
58
+ the change is made. However, calling <code>emitter.setMaxListeners(n)</code> still has
59
+ precedence over <code>events.defaultMaxListeners</code>.</p>
60
+ <p>This is not a hard limit. The <code>EventEmitter</code> instance will allow
61
+ more listeners to be added but will output a trace warning to stderr indicating
62
+ that a &quot;possible EventEmitter memory leak&quot; has been detected. For any single
63
+ <code>EventEmitter</code>, the <code>emitter.getMaxListeners()</code> and <code>emitter.setMaxListeners()</code> methods can be used to
64
+ temporarily avoid this warning:</p>
65
+ <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>
66
+ </code><button type="button">Copy</button></pre>
67
+
68
+ <p>The <code>--trace-warnings</code> command-line flag can be used to display the
69
+ stack trace for such warnings.</p>
70
+ <p>The emitted warning can be inspected with <code>process.on('warning')</code> and will
71
+ have the additional <code>emitter</code>, <code>type</code>, and <code>count</code> properties, referring to
72
+ the event emitter instance, the event's name and the number of attached
73
+ listeners, respectively.
74
+ Its <code>name</code> property is set to <code>'MaxListenersExceededWarning'</code>.</p>
75
+ </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>
76
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.defaultMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
77
+ <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
78
+ regular <code>'error'</code> listener is installed.</p>
79
+ </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>
80
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.errorMonitor</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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.23/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>
81
+ </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>
82
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
83
+ </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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L377">src/websocket/NordWebSocketClient.ts:377</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>
84
+ </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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L166">src/websocket/NordWebSocketClient.ts:166</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
85
+ to each.</p>
86
+ <p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
87
+ <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>
88
+ </code><button type="button">Copy</button></pre>
89
+
90
+ </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>
91
+ </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.23/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
92
+ listeners. The values in the array are strings or <code>Symbol</code>s.</p>
93
+ <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>
94
+ </code><button type="button">Copy</button></pre>
95
+
96
+ </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>
97
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.eventNames</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
98
+ set by <code>emitter.setMaxListeners(n)</code> or defaults to <a href="NordWebSocketClient.html#defaultmaxlisteners" class="tsd-kind-property">EventEmitter.defaultMaxListeners</a>.</p>
99
+ </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>
100
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>.
101
+ If <code>listener</code> is provided, it will return how many times the listener is found
102
+ in the list of the listeners of the event.</p>
103
+ </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>
104
+ </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>
105
+ </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>
106
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
107
+ <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>
108
+ </code><button type="button">Copy</button></pre>
109
+
110
+ </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>
111
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
112
+ </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>
113
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.off</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
114
+ named <code>eventName</code>. No checks are made to see if the <code>listener</code> has already
115
+ been added. Multiple calls passing the same combination of <code>eventName</code> and
116
+ <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
117
+ <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>
118
+ </code><button type="button">Copy</button></pre>
119
+
120
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
121
+ <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
122
+ event listener to the beginning of the listeners array.</p>
123
+ <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>
124
+ </code><button type="button">Copy</button></pre>
125
+
126
+ </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>
127
+ </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>
128
+ </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>
129
+ </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.23/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
130
+ next time <code>eventName</code> is triggered, this listener is removed and then invoked.</p>
131
+ <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>
132
+ </code><button type="button">Copy</button></pre>
133
+
134
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
135
+ <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
136
+ event listener to the beginning of the listeners array.</p>
137
+ <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>
138
+ </code><button type="button">Copy</button></pre>
139
+
140
+ </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>
141
+ </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>
142
+ </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>
143
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
144
+ event named <code>eventName</code>. No checks are made to see if the <code>listener</code> has
145
+ already been added. Multiple calls passing the same combination of <code>eventName</code>
146
+ and <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
147
+ <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>
148
+ </code><button type="button">Copy</button></pre>
149
+
150
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
151
+ </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>
152
+ </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>
153
+ </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>
154
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
155
+ listener is removed, and then invoked.</p>
156
+ <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>
157
+ </code><button type="button">Copy</button></pre>
158
+
159
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
160
+ </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>
161
+ </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>
162
+ </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>
163
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependOnceListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>,
164
+ including any wrappers (such as those created by <code>.once()</code>).</p>
165
+ <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>
166
+ </code><button type="button">Copy</button></pre>
167
+
168
+ </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>
169
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.rawListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
170
+ <p>It is bad practice to remove listeners added elsewhere in the code,
171
+ particularly when the <code>EventEmitter</code> instance was created by some other
172
+ component or module (e.g. sockets or file streams).</p>
173
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
174
+ </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>
175
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeAllListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
176
+ <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>
177
+ </code><button type="button">Copy</button></pre>
178
+
179
+ <p><code>removeListener()</code> will remove, at most, one instance of a listener from the
180
+ listener array. If any single listener has been added multiple times to the
181
+ listener array for the specified <code>eventName</code>, then <code>removeListener()</code> must be
182
+ called multiple times to remove each instance.</p>
183
+ <p>Once an event is emitted, all listeners attached to it at the
184
+ 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
185
+ will not remove them from<code>emit()</code> in progress. Subsequent events behave as expected.</p>
186
+ <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>
187
+ </code><button type="button">Copy</button></pre>
188
+
189
+ <p>Because listeners are managed using an internal array, calling this will
190
+ change the position indices of any listener registered <em>after</em> the listener
191
+ being removed. This will not impact the order in which listeners are called,
192
+ but it means that any copies of the listener array as returned by
193
+ the <code>emitter.listeners()</code> method will need to be recreated.</p>
194
+ <p>When a single function has been added as a handler multiple times for a single
195
+ event (as in the example below), <code>removeListener()</code> will remove the most
196
+ recently added instance. In the example the <code>once('ping')</code> listener is removed:</p>
197
+ <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>
198
+ </code><button type="button">Copy</button></pre>
199
+
200
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
201
+ </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>
202
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
203
+ added for a particular event. This is a useful default that helps finding
204
+ memory leaks. The <code>emitter.setMaxListeners()</code> method allows the limit to be
205
+ 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>
206
+ <p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
207
+ </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>
208
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
209
+ </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>
210
+ </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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L284">src/websocket/NordWebSocketClient.ts:284</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>
211
+ </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>
212
+ </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-ts/blob/0ccd231a58c45ad8470295b8146824da36e480d6/src/websocket/NordWebSocketClient.ts#L331">src/websocket/NordWebSocketClient.ts:331</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>
213
+ <p>Listening to the <code>abort</code> event on abort signals is unsafe and may
214
+ lead to resource leaks since another third party with the signal can
215
+ call <code>e.stopImmediatePropagation()</code>. Unfortunately Node.js cannot change
216
+ this since it would violate the web standard. Additionally, the original
217
+ API makes it easy to forget to remove listeners.</p>
218
+ <p>This API allows safely using <code>AbortSignal</code>s in Node.js APIs by solving these
219
+ two issues by listening to the event such that <code>stopImmediatePropagation</code> does
220
+ not prevent the listener from running.</p>
221
+ <p>Returns a disposable so that it may be unsubscribed from more easily.</p>
222
+ <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>
223
+ </code><button type="button">Copy</button></pre>
224
+
225
+ </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>
226
+ <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>
227
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addAbortListener</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
228
+ <p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.listeners</code> on
229
+ the emitter.</p>
230
+ <p>For <code>EventTarget</code>s this is the only way to get the event listeners for the
231
+ event target. This is useful for debugging and diagnostic purposes.</p>
232
+ <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>
233
+ </code><button type="button">Copy</button></pre>
234
+
235
+ </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>
236
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getEventListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
237
+ <p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.getMaxListeners</code> on
238
+ the emitter.</p>
239
+ <p>For <code>EventTarget</code>s this is the only way to get the max event listeners for the
240
+ event target. If the number of event handlers on a single EventTarget exceeds
241
+ the max set, the EventTarget will print a warning.</p>
242
+ <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>
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 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>
246
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
247
+ <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>
248
+ </code><button type="button">Copy</button></pre>
249
+
250
+ </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>
251
+ </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>
252
+ </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>
253
+ </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>
254
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
255
+ </code><button type="button">Copy</button></pre>
256
+
257
+ <p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
258
+ if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
259
+ exiting the loop. The <code>value</code> returned by each iteration is an array
260
+ composed of the emitted event arguments.</p>
261
+ <p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
262
+ <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>
263
+ </code><button type="button">Copy</button></pre>
264
+
265
+ <p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
266
+ <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>
267
+ </code><button type="button">Copy</button></pre>
268
+
269
+ </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>
270
+ <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>
271
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
272
+ </code><button type="button">Copy</button></pre>
273
+
274
+ <p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
275
+ if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
276
+ exiting the loop. The <code>value</code> returned by each iteration is an array
277
+ composed of the emitted event arguments.</p>
278
+ <p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
279
+ <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>
280
+ </code><button type="button">Copy</button></pre>
281
+
282
+ <p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
283
+ <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>
284
+ </code><button type="button">Copy</button></pre>
285
+
286
+ </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>
287
+ <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>
288
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
289
+ event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
290
+ The <code>Promise</code> will resolve with an array of all the arguments emitted to the
291
+ given event.</p>
292
+ <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
293
+ semantics and does not listen to the <code>'error'</code> event.</p>
294
+ <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>
295
+ </code><button type="button">Copy</button></pre>
296
+
297
+ <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
298
+ '<code>error'</code> event itself, then it is treated as any other kind of event without
299
+ special handling:</p>
300
+ <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>
301
+ </code><button type="button">Copy</button></pre>
302
+
303
+ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
304
+ <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>
305
+ </code><button type="button">Copy</button></pre>
306
+
307
+ </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>
308
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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
309
+ event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
310
+ The <code>Promise</code> will resolve with an array of all the arguments emitted to the
311
+ given event.</p>
312
+ <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
313
+ semantics and does not listen to the <code>'error'</code> event.</p>
314
+ <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>
315
+ </code><button type="button">Copy</button></pre>
316
+
317
+ <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
318
+ '<code>error'</code> event itself, then it is treated as any other kind of event without
319
+ special handling:</p>
320
+ <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>
321
+ </code><button type="button">Copy</button></pre>
322
+
323
+ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
324
+ <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>
325
+ </code><button type="button">Copy</button></pre>
326
+
327
+ </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>
328
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>
329
+ </code><button type="button">Copy</button></pre>
330
+
331
+ </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>
332
+ </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}
333
+ objects.</p>
334
+ </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>
335
+ </div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/.pnpm/@types+node@20.17.23/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>