@breautek/storm 8.3.0 → 8.5.0
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.
- package/CHANGELOG.md +15 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +16 -16
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +259 -230
- package/docs/classes/Application.html +173 -173
- package/docs/classes/BackendAuthenticationMiddleware.html +5 -5
- package/docs/classes/CORSMiddleware.html +10 -10
- package/docs/classes/ConfigLoader.html +5 -5
- package/docs/classes/Database.html +13 -13
- package/docs/classes/DatabaseCastObject.html +5 -5
- package/docs/classes/DatabaseConnection.html +48 -46
- package/docs/classes/DatabaseQueryError.html +26 -22
- package/docs/classes/DeadLockError.html +27 -23
- package/docs/classes/DiskSpaceError.html +22 -22
- package/docs/classes/DropTemporaryTableQuery.html +17 -17
- package/docs/classes/DuplicateEntryError.html +22 -22
- package/docs/classes/EntityNotFoundError.html +22 -22
- package/docs/classes/ExpiredTokenError.html +22 -22
- package/docs/classes/Handler.html +14 -14
- package/docs/classes/InternalError.html +22 -22
- package/docs/classes/InvalidCredentialsError.html +22 -22
- package/docs/classes/InvalidValueError.html +22 -22
- package/docs/classes/LineString.html +5 -5
- package/docs/classes/LockWaitTimeoutError.html +27 -23
- package/docs/classes/ManagedDatabaseConnection.html +24 -22
- package/docs/classes/Middleware.html +4 -4
- package/docs/classes/MissingConfigError.html +22 -22
- package/docs/classes/MissingParameterError.html +22 -22
- package/docs/classes/MySQLConnection.html +49 -47
- package/docs/classes/MySQLDatabase.html +14 -14
- package/docs/classes/NotImplementedError.html +22 -22
- package/docs/classes/Point.html +5 -5
- package/docs/classes/Polygon.html +5 -5
- package/docs/classes/Query.html +17 -17
- package/docs/classes/RawError.html +23 -23
- package/docs/classes/RawQuery.html +17 -17
- package/docs/classes/Request.html +19 -19
- package/docs/classes/Response.html +12 -12
- package/docs/classes/ResponseData.html +8 -8
- package/docs/classes/ServiceProvider.html +16 -16
- package/docs/classes/ServiceResponse.html +6 -6
- package/docs/classes/SetSessionVariableQuery.html +17 -17
- package/docs/classes/StormError.html +22 -22
- package/docs/classes/TemporaryTableQuery.html +17 -17
- package/docs/classes/TimeoutError.html +23 -23
- package/docs/classes/Token.html +3 -3
- package/docs/classes/TokenManager.html +5 -5
- package/docs/classes/Transaction.html +9 -9
- package/docs/classes/UnauthorizedAccessError.html +22 -22
- package/docs/enums/ErrorCode.html +10 -10
- package/docs/enums/ExitCode.html +3 -3
- package/docs/enums/HTTPMethod.html +5 -5
- package/docs/enums/IsolationLevel.html +5 -5
- package/docs/enums/JWTError.html +3 -3
- package/docs/enums/StatusCode.html +49 -49
- package/docs/functions/getInstance.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/IAuthTokenData.html +4 -4
- package/docs/interfaces/ICloudwatchConfig.html +4 -4
- package/docs/interfaces/ICloudwatchCredentials.html +3 -3
- package/docs/interfaces/ICloudwatchStreamConfig.html +3 -3
- package/docs/interfaces/IConfig.html +10 -10
- package/docs/interfaces/IDatabaseConfig.html +7 -7
- package/docs/interfaces/IDatabaseConnection.html +19 -17
- package/docs/interfaces/IDatabasePosition.html +4 -4
- package/docs/interfaces/IErrorResponse.html +6 -6
- package/docs/interfaces/IFormData.html +3 -3
- package/docs/interfaces/IHandler.html +2 -2
- package/docs/interfaces/IInsertQueryResult.html +4 -4
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IOKPacket.html +10 -10
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +7 -7
- package/docs/interfaces/IRequestResponse.html +3 -3
- package/docs/interfaces/IServiceHeaders.html +1 -1
- package/docs/interfaces/ISetSessionVariableQueryInput.html +3 -3
- package/docs/interfaces/IStormCLIArgs.html +7 -7
- package/docs/interfaces/ITemporaryTableQueryInput.html +3 -3
- package/docs/interfaces/IUpdateQueryResult.html +3 -3
- package/docs/interfaces/formidable.EmitData.html +5 -0
- package/docs/interfaces/formidable.EventData.html +8 -0
- package/docs/interfaces/formidable.File.html +25 -0
- package/docs/interfaces/formidable.FileJSON.html +19 -0
- package/docs/interfaces/formidable.Options.html +88 -0
- package/docs/interfaces/formidable.Part.html +148 -0
- package/docs/modules/formidable.html +1 -1
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IHandlerError.html +2 -2
- package/docs/types/IHandlerResponse.html +2 -2
- package/docs/types/IStoredProcedureResult.html +3 -3
- package/docs/types/TCoordinate.html +1 -1
- package/docs/types/formidable.BufferEncoding.html +1 -0
- package/docs/types/formidable.DefaultOptions.html +1 -0
- package/docs/types/formidable.EnabledPlugins.html +1 -0
- package/docs/types/formidable.EventNames.html +15 -0
- package/docs/types/formidable.Fields.html +1 -0
- package/docs/types/formidable.Files.html +1 -0
- package/docs/types/formidable.MappedParsers.html +1 -0
- package/docs/types/formidable.Plugin.html +1 -0
- package/docs/types/formidable.PluginFunction.html +1 -0
- package/docs/types/formidable.Plugins.html +1 -0
- package/docs/variables/formidable.html +1 -0
- package/eslint.config.js +14 -0
- package/lib/Application.js +2 -0
- package/lib/Application.js.map +1 -1
- package/lib/BackendAuthenticationMiddleware.js +0 -1
- package/lib/BackendAuthenticationMiddleware.js.map +1 -1
- package/lib/ConfigLoader.js +1 -0
- package/lib/ConfigLoader.js.map +1 -1
- package/lib/DatabaseConnection.d.ts +1 -0
- package/lib/DatabaseConnection.js +0 -1
- package/lib/DatabaseConnection.js.map +1 -1
- package/lib/DatabaseQueryError.d.ts +6 -0
- package/lib/DatabaseQueryError.js +8 -1
- package/lib/DatabaseQueryError.js.map +1 -1
- package/lib/DropTemporaryTableQuery.js.map +1 -1
- package/lib/ExpiredTokenError.js +0 -1
- package/lib/ExpiredTokenError.js.map +1 -1
- package/lib/IDatabaseConnection.d.ts +6 -0
- package/lib/InternalError.js +0 -1
- package/lib/InternalError.js.map +1 -1
- package/lib/InvalidCredentialsError.js +0 -1
- package/lib/InvalidCredentialsError.js.map +1 -1
- package/lib/InvalidValueError.js +0 -1
- package/lib/InvalidValueError.js.map +1 -1
- package/lib/ManagedDatabaseConnection.d.ts +2 -0
- package/lib/ManagedDatabaseConnection.js +5 -2
- package/lib/ManagedDatabaseConnection.js.map +1 -1
- package/lib/Middleware.js +0 -1
- package/lib/Middleware.js.map +1 -1
- package/lib/MySQLConnection.d.ts +2 -0
- package/lib/MySQLConnection.js +15 -13
- package/lib/MySQLConnection.js.map +1 -1
- package/lib/MySQLDatabase.js +0 -2
- package/lib/MySQLDatabase.js.map +1 -1
- package/lib/Query.js.map +1 -1
- package/lib/Request.js.map +1 -1
- package/lib/Response.js.map +1 -1
- package/lib/ServiceProvider.js +0 -5
- package/lib/ServiceProvider.js.map +1 -1
- package/lib/TokenManager.js.map +1 -1
- package/lib/mysql/queryFormatter.d.ts +1 -0
- package/lib/mysql/queryFormatter.js +17 -0
- package/lib/mysql/queryFormatter.js.map +1 -0
- package/lib/private/ConnectionReplicationWaiter.js +2 -1
- package/lib/private/ConnectionReplicationWaiter.js.map +1 -1
- package/package.json +14 -17
- package/src/Application.ts +3 -1
- package/src/BackendAuthenticationMiddleware.ts +0 -1
- package/src/ConfigLoader.ts +2 -1
- package/src/DatabaseConnection.ts +4 -5
- package/src/DatabaseQueryError.ts +9 -1
- package/src/DropTemporaryTableQuery.ts +3 -3
- package/src/ExpiredTokenError.ts +0 -1
- package/src/IDatabaseConnection.ts +7 -0
- package/src/InternalError.ts +0 -1
- package/src/InvalidCredentialsError.ts +0 -1
- package/src/InvalidValueError.ts +0 -1
- package/src/ManagedDatabaseConnection.ts +7 -2
- package/src/Middleware.ts +0 -1
- package/src/MySQLConnection.ts +18 -12
- package/src/MySQLDatabase.ts +0 -2
- package/src/Query.ts +1 -1
- package/src/Request.ts +2 -1
- package/src/Response.ts +1 -1
- package/src/ServiceProvider.ts +0 -5
- package/src/TokenManager.ts +1 -1
- package/src/mysql/queryFormatter.ts +14 -0
- package/src/private/ConnectionReplicationWaiter.ts +2 -1
- package/.eslintrc.js +0 -61
- package/docs/variables/formidable-1.html +0 -1
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="
|
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section
|
|
3
|
-
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="
|
|
4
|
-
<a href="
|
|
5
|
-
<a href="
|
|
6
|
-
<a href="
|
|
7
|
-
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="
|
|
8
|
-
<a href="
|
|
9
|
-
<a href="
|
|
10
|
-
<a href="
|
|
11
|
-
<a href="
|
|
12
|
-
<a href="
|
|
13
|
-
<a href="
|
|
14
|
-
<a href="
|
|
15
|
-
<a href="
|
|
16
|
-
<a href="
|
|
17
|
-
<a href="
|
|
18
|
-
<a href="
|
|
19
|
-
<a href="
|
|
20
|
-
<a href="
|
|
21
|
-
<a href="
|
|
22
|
-
<a href="
|
|
23
|
-
<a href="
|
|
24
|
-
<a href="
|
|
25
|
-
<a href="
|
|
26
|
-
<a href="
|
|
27
|
-
<a href="
|
|
28
|
-
<a href="
|
|
29
|
-
<a href="
|
|
30
|
-
<a href="
|
|
31
|
-
<a href="
|
|
32
|
-
<a href="
|
|
33
|
-
<a href="
|
|
34
|
-
<a href="
|
|
35
|
-
<a href="
|
|
36
|
-
<a href="
|
|
37
|
-
<a href="
|
|
38
|
-
<a href="
|
|
39
|
-
<a href="
|
|
40
|
-
<a href="
|
|
41
|
-
<a href="
|
|
42
|
-
<a href="
|
|
43
|
-
<a href="
|
|
44
|
-
<a href="
|
|
45
|
-
<a href="
|
|
46
|
-
<a href="
|
|
47
|
-
<a href="
|
|
48
|
-
<a href="
|
|
49
|
-
<a href="
|
|
50
|
-
<a href="
|
|
51
|
-
<a href="
|
|
52
|
-
<a href="
|
|
53
|
-
<a href="
|
|
54
|
-
<a href="
|
|
55
|
-
<a href="
|
|
56
|
-
<a href="
|
|
57
|
-
<a href="
|
|
58
|
-
<a href="
|
|
59
|
-
<a href="
|
|
60
|
-
<a href="
|
|
61
|
-
<a href="
|
|
62
|
-
</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"><
|
|
63
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">configPath</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="
|
|
64
|
-
</div></div><aside class="tsd-sources"><p>Overrides EventEmitter.constructor</p><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
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>Application | @breautek/storm</title><meta name="description" content="Documentation for @breautek/storm"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@breautek/storm</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">Application</a></li></ul><h1>Class Application<TConfig, TAuthToken, TDBConfig, TDBConnectionAPI><code class="tsd-tag">Abstract</code></h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Main entry point for the Application. Should be extended and have the abstract methods implemented.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="tconfig"><span class="tsd-kind-type-parameter">TConfig</span> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a> = <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a></span></li><li><span id="tauthtoken"><span class="tsd-kind-type-parameter">TAuthToken</span> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a> = <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a></span></li><li><span id="tdbconfig"><span class="tsd-kind-type-parameter">TDBConfig</span> = <span class="tsd-signature-type">any</span></span></li><li><span id="tdbconnectionapi"><span class="tsd-kind-type-parameter">TDBConnectionAPI</span> = <span class="tsd-signature-type">any</span></span></li></ul></section><section class="tsd-panel tsd-hierarchy" data-refl="3"><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">Application</span></li></ul></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L56">src/Application.ts:56</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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h5 class="tsd-index-heading uppercase">Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="#constructor" class="tsd-index-link deprecated"><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>
|
|
3
|
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="#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>
|
|
4
|
+
<a href="#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>
|
|
5
|
+
<a href="#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>
|
|
6
|
+
<a href="#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>
|
|
7
|
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="#_attachhandlers" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>attach<wbr/>Handlers</span></a>
|
|
8
|
+
<a href="#_buildargoptions" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>build<wbr/>Arg<wbr/>Options</span></a>
|
|
9
|
+
<a href="#_closedatabase" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>close<wbr/>Database</span></a>
|
|
10
|
+
<a href="#_closesocket" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>close<wbr/>Socket</span></a>
|
|
11
|
+
<a href="#_createlogger" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>create<wbr/>Logger</span></a>
|
|
12
|
+
<a href="#_getversion" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>get<wbr/>Version</span></a>
|
|
13
|
+
<a href="#_initdb" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>init<wbr/>DB</span></a>
|
|
14
|
+
<a href="#_initialize" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>initialize</span></a>
|
|
15
|
+
<a href="#_initlogger" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>init<wbr/>Logger</span></a>
|
|
16
|
+
<a href="#_onbeforereadyasync" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Before<wbr/>Ready<wbr/>Async</span></a>
|
|
17
|
+
<a href="#_onconfigload" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Config<wbr/>Load</span></a>
|
|
18
|
+
<a href="#_onready" class="tsd-index-link tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Ready</span></a>
|
|
19
|
+
<a href="#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>
|
|
20
|
+
<a href="#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>
|
|
21
|
+
<a href="#attachhandler" 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>attach<wbr/>Handler</span></a>
|
|
22
|
+
<a href="#attachhandlerinstance" 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>attach<wbr/>Handler<wbr/>Instance</span></a>
|
|
23
|
+
<a href="#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>
|
|
24
|
+
<a href="#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>
|
|
25
|
+
<a href="#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>
|
|
26
|
+
<a href="#getcmdlineargs" 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>get<wbr/>Cmd<wbr/>Line<wbr/>Args</span></a>
|
|
27
|
+
<a href="#getconfig" 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>get<wbr/>Config</span></a>
|
|
28
|
+
<a href="#getconfigfilepath" 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>get<wbr/>Config<wbr/>File<wbr/>Path</span></a>
|
|
29
|
+
<a href="#getconfigfromcliargs" 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>get<wbr/>Config<wbr/>From<wbr/>CLI<wbr/>Args</span></a>
|
|
30
|
+
<a href="#getdb" 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>get<wbr/>DB</span></a>
|
|
31
|
+
<a href="#getlocalconfigfilepath" 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>get<wbr/>Local<wbr/>Config<wbr/>File<wbr/>Path</span></a>
|
|
32
|
+
<a href="#getlogger" 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>get<wbr/>Logger</span></a>
|
|
33
|
+
<a href="#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>
|
|
34
|
+
<a href="#getname" 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>get<wbr/>Name</span></a>
|
|
35
|
+
<a href="#getport" 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>get<wbr/>Port</span></a>
|
|
36
|
+
<a href="#getprogram" 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>get<wbr/>Program</span></a>
|
|
37
|
+
<a href="#getrequestsizelimit" 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>get<wbr/>Request<wbr/>Size<wbr/>Limit</span></a>
|
|
38
|
+
<a href="#gettokenmanager" 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>get<wbr/>Token<wbr/>Manager</span></a>
|
|
39
|
+
<a href="#getversion" 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>get<wbr/>Version</span></a>
|
|
40
|
+
<a href="#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>
|
|
41
|
+
<a href="#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>
|
|
42
|
+
<a href="#loadconfig" class="tsd-index-link deprecated"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Config</span></a>
|
|
43
|
+
<a href="#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>
|
|
44
|
+
<a href="#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>
|
|
45
|
+
<a href="#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>
|
|
46
|
+
<a href="#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>
|
|
47
|
+
<a href="#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>
|
|
48
|
+
<a href="#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>
|
|
49
|
+
<a href="#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>
|
|
50
|
+
<a href="#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>
|
|
51
|
+
<a href="#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>
|
|
52
|
+
<a href="#settokenmanager" 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>set<wbr/>Token<wbr/>Manager</span></a>
|
|
53
|
+
<a href="#shouldlisten" 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>should<wbr/>Listen</span></a>
|
|
54
|
+
<a href="#start" 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>start</span></a>
|
|
55
|
+
<a href="#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>
|
|
56
|
+
<a href="#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>
|
|
57
|
+
<a href="#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>
|
|
58
|
+
<a href="#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>
|
|
59
|
+
<a href="#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>
|
|
60
|
+
<a href="#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>
|
|
61
|
+
<a href="#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>
|
|
62
|
+
</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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Constructors</h2></summary><section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="constructor"><span class="deprecated">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" id="constructorapplication"><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">Application</span><span class="tsd-signature-symbol"><</span><br/> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a> <span class="tsd-signature-symbol">=</span> <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a><span class="tsd-signature-symbol">,</span><br/> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a> <span class="tsd-signature-symbol">=</span> <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a><span class="tsd-signature-symbol">,</span><br/> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></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><br/> <span class="tsd-kind-parameter">configPath</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="" class="tsd-signature-type tsd-kind-class">Application</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span><a href="#constructorapplication" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="constructorapplicationtconfig"><span class="tsd-kind-type-parameter">TConfig</span> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a> = <a href="../interfaces/IConfig.html" class="tsd-signature-type tsd-kind-interface">IConfig</a></span></li><li><span id="constructorapplicationtauthtoken"><span class="tsd-kind-type-parameter">TAuthToken</span> <span class="tsd-signature-keyword">extends</span> <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a> = <a href="../interfaces/IAuthTokenData.html" class="tsd-signature-type tsd-kind-interface">IAuthTokenData</a></span></li><li><span id="constructorapplicationtdbconfig"><span class="tsd-kind-type-parameter">TDBConfig</span> = <span class="tsd-signature-type">any</span></span></li><li><span id="constructorapplicationtdbconnectionapi"><span class="tsd-kind-type-parameter">TDBConnectionAPI</span> = <span class="tsd-signature-type">any</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">name</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The application name</p>
|
|
63
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">configPath</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="" class="tsd-signature-type tsd-kind-class">Application</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-deprecated"><h4 class="tsd-anchor-link" id="deprecated">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>The directory where bt-config.json and bt-local-config.json can be found. Defaults to current working directory.</p>
|
|
64
|
+
</div></div><aside class="tsd-sources"><p>Overrides EventEmitter.constructor</p><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L98">src/Application.ts:98</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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Properties</h2></summary><section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="capturerejections"><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>
|
|
65
65
|
<p>Change the default <code>captureRejections</code> option on all new <code>EventEmitter</code> objects.</p>
|
|
66
|
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
67
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejections</p><ul><li>Defined in node_modules/@types/node/events.d.ts:459</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
66
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since">Since<a href="#since" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v13.4.0, v12.16.0</p>
|
|
67
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejections</p><ul><li>Defined in node_modules/@types/node/events.d.ts:459</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="capturerejectionsymbol"><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="#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>
|
|
68
68
|
<p>See how to write a custom <code>rejection handler</code>.</p>
|
|
69
|
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
70
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejectionSymbol</p><ul><li>Defined in node_modules/@types/node/events.d.ts:452</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
69
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-1">Since<a href="#since-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v13.4.0, v12.16.0</p>
|
|
70
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.captureRejectionSymbol</p><ul><li>Defined in node_modules/@types/node/events.d.ts:452</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="defaultmaxlisteners"><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
|
|
71
71
|
event. This limit can be changed for individual <code>EventEmitter</code> instances
|
|
72
72
|
using the <code>emitter.setMaxListeners(n)</code> method. To change the default
|
|
73
73
|
for <em>all</em><code>EventEmitter</code> instances, the <code>events.defaultMaxListeners</code> property
|
|
@@ -81,7 +81,7 @@ more listeners to be added but will output a trace warning to stderr indicating
|
|
|
81
81
|
that a "possible EventEmitter memory leak" has been detected. For any single
|
|
82
82
|
<code>EventEmitter</code>, the <code>emitter.getMaxListeners()</code> and <code>emitter.setMaxListeners()</code> methods can be used to
|
|
83
83
|
temporarily avoid this warning:</p>
|
|
84
|
-
<pre><code class="js"><span class="hl-
|
|
84
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">emitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">setMaxListeners</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">getMaxListeners</span><span class="hl-3">() + </span><span class="hl-2">1</span><span class="hl-3">);</span><br/><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-8">// do stuff</span><br/><span class="hl-3"> </span><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">setMaxListeners</span><span class="hl-3">(</span><span class="hl-4">Math</span><span class="hl-3">.</span><span class="hl-5">max</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">getMaxListeners</span><span class="hl-3">() - </span><span class="hl-2">1</span><span class="hl-3">, </span><span class="hl-2">0</span><span class="hl-3">));</span><br/><span class="hl-3">});</span>
|
|
85
85
|
</code><button type="button">Copy</button></pre>
|
|
86
86
|
|
|
87
87
|
<p>The <code>--trace-warnings</code> command-line flag can be used to display the
|
|
@@ -91,124 +91,124 @@ have the additional <code>emitter</code>, <code>type</code>, and <code>count</co
|
|
|
91
91
|
the event emitter instance, the event's name and the number of attached
|
|
92
92
|
listeners, respectively.
|
|
93
93
|
Its <code>name</code> property is set to <code>'MaxListenersExceededWarning'</code>.</p>
|
|
94
|
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
95
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.defaultMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:498</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
94
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-2">Since<a href="#since-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.11.2</p>
|
|
95
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.defaultMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:498</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="errormonitor"><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="#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>
|
|
96
96
|
<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
|
|
97
97
|
regular <code>'error'</code> listener is installed.</p>
|
|
98
|
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
99
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.errorMonitor</p><ul><li>Defined in 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"><
|
|
98
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-3">Since<a href="#since-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v13.6.0, v12.17.0</p>
|
|
99
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.errorMonitor</p><ul><li>Defined in 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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Methods</h2></summary><section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_attachhandlers"><code class="tsd-tag">Protected</code> <code class="tsd-tag">Abstract</code><span>_<wbr/>attach<wbr/>Handlers</span><a href="#_attachhandlers" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_attachhandlers-1"><span class="tsd-kind-call-signature">_attachHandlers</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_attachhandlers-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>Subclasses are expected to attach the API handlers for their service. This will be invoked during application startup.</p>
|
|
100
100
|
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise<void></p>
|
|
101
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
102
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="
|
|
103
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Database.html" class="tsd-signature-type tsd-kind-class">Database</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="
|
|
104
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="
|
|
105
|
-
</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/breautek/storm/blob/
|
|
106
|
-
</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/breautek/storm/blob/
|
|
107
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
108
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:597</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><
|
|
101
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L405">src/Application.ts:405</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_buildargoptions"><code class="tsd-tag">Protected</code><span>_<wbr/>build<wbr/>Arg<wbr/>Options</span><a href="#_buildargoptions" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_buildargoptions-1"><span class="tsd-kind-call-signature">_buildArgOptions</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">program</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Command</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#_buildargoptions-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">program</span>: <span class="tsd-signature-type">Command</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L324">src/Application.ts:324</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_closedatabase"><code class="tsd-tag">Protected</code><span>_<wbr/>close<wbr/>Database</span><a href="#_closedatabase" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_closedatabase-1"><span class="tsd-kind-call-signature">_closeDatabase</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_closedatabase-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L382">src/Application.ts:382</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_closesocket"><code class="tsd-tag">Protected</code><span>_<wbr/>close<wbr/>Socket</span><a href="#_closesocket" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_closesocket-1"><span class="tsd-kind-call-signature">_closeSocket</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_closesocket-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L388">src/Application.ts:388</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_createlogger"><code class="tsd-tag">Protected</code><span>_<wbr/>create<wbr/>Logger</span><a href="#_createlogger" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_createlogger-1"><span class="tsd-kind-call-signature">_createLogger</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">BaseLogger</span><a href="#_createlogger-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">BaseLogger</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L210">src/Application.ts:210</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_getversion"><code class="tsd-tag">Protected</code><span>_<wbr/>get<wbr/>Version</span><a href="#_getversion" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_getversion-1"><span class="tsd-kind-call-signature">_getVersion</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#_getversion-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L298">src/Application.ts:298</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_initdb"><code class="tsd-tag">Protected</code><span>_<wbr/>init<wbr/>DB</span><a href="#_initdb" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_initdb-1"><span class="tsd-kind-call-signature">_initDB</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Database.html" class="tsd-signature-type tsd-kind-class">Database</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#_initdb-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>Subclasses are expected to override this to configure their database setup, if the service uses a database.</p>
|
|
102
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></span><div class="tsd-comment tsd-typography"><p>The bt-config object</p>
|
|
103
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Database.html" class="tsd-signature-type tsd-kind-class">Database</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L566">src/Application.ts:566</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_initialize"><code class="tsd-tag">Protected</code><span>_<wbr/>initialize</span><a href="#_initialize" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_initialize-1"><span class="tsd-kind-call-signature">_initialize</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_initialize-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L206">src/Application.ts:206</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_initlogger"><code class="tsd-tag">Protected</code><span>_<wbr/>init<wbr/>Logger</span><a href="#_initlogger" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_initlogger-1"><span class="tsd-kind-call-signature">_initLogger</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">BaseLogger</span><span class="tsd-signature-symbol">></span><a href="#_initlogger-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">BaseLogger</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L214">src/Application.ts:214</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_onbeforereadyasync"><code class="tsd-tag">Protected</code><span>_<wbr/>on<wbr/>Before<wbr/>Ready<wbr/>Async</span><a href="#_onbeforereadyasync" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_onbeforereadyasync-1"><span class="tsd-kind-call-signature">_onBeforeReadyAsync</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_onbeforereadyasync-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L570">src/Application.ts:570</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_onconfigload"><code class="tsd-tag">Protected</code><span>_<wbr/>on<wbr/>Config<wbr/>Load</span><a href="#_onconfigload" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_onconfigload-1"><span class="tsd-kind-call-signature">_onConfigLoad</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#_onconfigload-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>Invoked once the config has been loaded and ready to be used.</p>
|
|
104
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">config</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></span><div class="tsd-comment tsd-typography"><p>The config object (as defined in bt-config.json/bt-local-config.json)</p>
|
|
105
|
+
</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/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L499">src/Application.ts:499</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-protected"><h3 class="tsd-anchor-link" id="_onready"><code class="tsd-tag">Protected</code><span>_<wbr/>on<wbr/>Ready</span><a href="#_onready" 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-protected"><li class=""><div class="tsd-signature tsd-anchor-link" id="_onready-1"><span class="tsd-kind-call-signature">_onReady</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#_onready-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>Invoked when the application is considered ready for operation.</p>
|
|
106
|
+
</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/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L575">src/Application.ts:575</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="capturerejectionsymbol-1"><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" id="capturerejectionsymbol-2"><span class="tsd-kind-call-signature">"[captureRejectionSymbol]"</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#capturerejectionsymbolk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <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 id="capturerejectionsymbolk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">error</span>: <span class="tsd-signature-type">Error</span></span></li><li><span><span class="tsd-kind-parameter">event</span>: <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/@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"><h3 class="tsd-anchor-link" id="addlistener"><span>add<wbr/>Listener</span><a href="#addlistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="addlistener-1"><span class="tsd-kind-call-signature">addListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#addlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><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">=></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>
|
|
107
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="addlistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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">=></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" id="since-4">Since<a href="#since-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
|
108
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:597</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="attachhandler"><span>attach<wbr/>Handler</span><a href="#attachhandler" 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" id="attachhandler-1"><span class="tsd-kind-call-signature">attachHandler</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">path</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">HandlerClass</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/IHandler.html" class="tsd-signature-type tsd-kind-interface">IHandler</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#attachhandler-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The URL API path. E.g. /api/myService/myCommand/</p>
|
|
109
109
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">HandlerClass</span>: <a href="../interfaces/IHandler.html" class="tsd-signature-type tsd-kind-interface">IHandler</a></span><div class="tsd-comment tsd-typography"><p>The concrete class (not the instance) of Handler to be used for this API.</p>
|
|
110
|
-
</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/breautek/storm/blob/
|
|
110
|
+
</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/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L351">src/Application.ts:351</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="attachhandlerinstance"><span>attach<wbr/>Handler<wbr/>Instance</span><a href="#attachhandlerinstance" 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" id="attachhandlerinstance-1"><span class="tsd-kind-call-signature">attachHandlerInstance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">path</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">handler</span><span class="tsd-signature-symbol">:</span> <a href="Handler.html" class="tsd-signature-type tsd-kind-class">Handler</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#attachhandlerinstance-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></span></li><li><span><span class="tsd-kind-parameter">handler</span>: <a href="Handler.html" class="tsd-signature-type tsd-kind-class">Handler</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L356">src/Application.ts:356</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="close"><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" id="close-1"><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">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L375">src/Application.ts:375</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="emit"><span>emit</span><a href="#emit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="emit-1"><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#emitk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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
|
|
111
111
|
to each.</p>
|
|
112
112
|
<p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
|
|
113
|
-
<pre><code class="js"><span class="hl-
|
|
113
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEmitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// First listener</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">firstListener</span><span class="hl-3">() {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'Helloooo! first listener'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><span class="hl-8">// Second listener</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">secondListener</span><span class="hl-3">(</span><span class="hl-4">arg1</span><span class="hl-3">, </span><span class="hl-4">arg2</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">`event with parameters </span><span class="hl-0">${</span><span class="hl-4">arg1</span><span class="hl-0">}</span><span class="hl-1">, </span><span class="hl-0">${</span><span class="hl-4">arg2</span><span class="hl-0">}</span><span class="hl-1"> in second listener`</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><span class="hl-8">// Third listener</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">thirdListener</span><span class="hl-3">(...</span><span class="hl-4">args</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">parameters</span><span class="hl-3"> = </span><span class="hl-4">args</span><span class="hl-3">.</span><span class="hl-5">join</span><span class="hl-3">(</span><span class="hl-1">', '</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">`event with parameters </span><span class="hl-0">${</span><span class="hl-4">parameters</span><span class="hl-0">}</span><span class="hl-1"> in third listener`</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">listeners</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">));</span><br/><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-2">1</span><span class="hl-3">, </span><span class="hl-2">2</span><span class="hl-3">, </span><span class="hl-2">3</span><span class="hl-3">, </span><span class="hl-2">4</span><span class="hl-3">, </span><span class="hl-2">5</span><span class="hl-3">);</span><br/><br/><span class="hl-8">// Prints:</span><br/><span class="hl-8">// [</span><br/><span class="hl-8">// [Function: firstListener],</span><br/><span class="hl-8">// [Function: secondListener],</span><br/><span class="hl-8">// [Function: thirdListener]</span><br/><span class="hl-8">// ]</span><br/><span class="hl-8">// Helloooo! first listener</span><br/><span class="hl-8">// event with parameters 1, 2 in second listener</span><br/><span class="hl-8">// event with parameters 1, 2, 3, 4, 5 in third listener</span>
|
|
114
114
|
</code><button type="button">Copy</button></pre>
|
|
115
115
|
|
|
116
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
117
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.emit</p><ul><li>Defined in node_modules/@types/node/events.d.ts:859</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
116
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="emitk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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" id="since-5">Since<a href="#since-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
|
117
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.emit</p><ul><li>Defined in node_modules/@types/node/events.d.ts:859</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="eventnames"><span>event<wbr/>Names</span><a href="#eventnames" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="eventnames-1"><span class="tsd-kind-call-signature">eventNames</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> (<span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span>)<span class="tsd-signature-symbol">[]</span><a href="#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
|
|
118
118
|
listeners. The values in the array are strings or <code>Symbol</code>s.</p>
|
|
119
|
-
<pre><code class="js"><span class="hl-
|
|
119
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEE</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {});</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'bar'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {});</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">sym</span><span class="hl-3"> = </span><span class="hl-5">Symbol</span><span class="hl-3">(</span><span class="hl-1">'symbol'</span><span class="hl-3">);</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">sym</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {});</span><br/><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">eventNames</span><span class="hl-3">());</span><br/><span class="hl-8">// Prints: [ 'foo', 'bar', Symbol(symbol) ]</span>
|
|
120
120
|
</code><button type="button">Copy</button></pre>
|
|
121
121
|
|
|
122
|
-
</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"
|
|
123
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.eventNames</p><ul><li>Defined in node_modules/@types/node/events.d.ts:922</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><
|
|
124
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
125
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
126
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Record</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">any</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
127
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
128
|
-
set by <code>emitter.setMaxListeners(n)</code> or defaults to <a href="
|
|
129
|
-
</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"
|
|
130
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:774</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><
|
|
131
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
132
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
133
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
122
|
+
</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" id="since-6">Since<a href="#since-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
|
123
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.eventNames</p><ul><li>Defined in node_modules/@types/node/events.d.ts:922</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getcmdlineargs"><span>get<wbr/>Cmd<wbr/>Line<wbr/>Args</span><a href="#getcmdlineargs" 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" id="getcmdlineargs-1"><span class="tsd-kind-call-signature">getCmdLineArgs</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/IStormCLIArgs.html" class="tsd-signature-type tsd-kind-interface">IStormCLIArgs</a><a href="#getcmdlineargs-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"><h4 class="tsd-returns-title">Returns <a href="../interfaces/IStormCLIArgs.html" class="tsd-signature-type tsd-kind-interface">IStormCLIArgs</a></h4><p>command line arguments</p>
|
|
124
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L526">src/Application.ts:526</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getconfig"><span>get<wbr/>Config</span><a href="#getconfig" 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" id="getconfig-1"><span class="tsd-kind-call-signature">getConfig</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><a href="#getconfig-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"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a></h4><p>the config object.</p>
|
|
125
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L483">src/Application.ts:483</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getconfigfilepath"><span>get<wbr/>Config<wbr/>File<wbr/>Path</span><a href="#getconfigfilepath" 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" id="getconfigfilepath-1"><span class="tsd-kind-call-signature">getConfigFilePath</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#getconfigfilepath-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L434">src/Application.ts:434</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getconfigfromcliargs"><span>get<wbr/>Config<wbr/>From<wbr/>CLI<wbr/>Args</span><a href="#getconfigfromcliargs" 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" id="getconfigfromcliargs-1"><span class="tsd-kind-call-signature">getConfigFromCLIArgs</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-type">Record</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">any</span><span class="tsd-signature-symbol">></span><a href="#getconfigfromcliargs-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>Override this method to map CLI args to customConfig</p>
|
|
126
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Record</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">any</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L334">src/Application.ts:334</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getdb"><span>get<wbr/>DB</span><a href="#getdb" 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" id="getdb-1"><span class="tsd-kind-call-signature">getDB</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="Database.html" class="tsd-signature-type tsd-kind-class">Database</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span><a href="#getdb-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"><h4 class="tsd-returns-title">Returns <a href="Database.html" class="tsd-signature-type tsd-kind-class">Database</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconfig">TDBConfig</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtdbconnectionapi">TDBConnectionAPI</a><span class="tsd-signature-symbol">></span></h4><p>the database pool. This will need to be casted based on your preferred database dialect.</p>
|
|
127
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L519">src/Application.ts:519</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getlocalconfigfilepath"><span>get<wbr/>Local<wbr/>Config<wbr/>File<wbr/>Path</span><a href="#getlocalconfigfilepath" 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" id="getlocalconfigfilepath-1"><span class="tsd-kind-call-signature">getLocalConfigFilePath</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#getlocalconfigfilepath-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L438">src/Application.ts:438</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getlogger"><span>get<wbr/>Logger</span><a href="#getlogger" 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" id="getlogger-1"><span class="tsd-kind-call-signature">getLogger</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">BaseLogger</span><a href="#getlogger-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">BaseLogger</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L279">src/Application.ts:279</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="getmaxlisteners"><span>get<wbr/>Max<wbr/>Listeners</span><a href="#getmaxlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="getmaxlisteners-1"><span class="tsd-kind-call-signature">getMaxListeners</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getmaxlisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the current max listener value for the <code>EventEmitter</code> which is either
|
|
128
|
+
set by <code>emitter.setMaxListeners(n)</code> or defaults to <a href="#defaultmaxlisteners" class="tsd-kind-property">EventEmitter.defaultMaxListeners</a>.</p>
|
|
129
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-7">Since<a href="#since-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v1.0.0</p>
|
|
130
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:774</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getname"><span>get<wbr/>Name</span><a href="#getname" 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" id="getname-1"><span class="tsd-kind-call-signature">getName</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#getname-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>the application name</p>
|
|
131
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L472">src/Application.ts:472</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getport"><span>get<wbr/>Port</span><a href="#getport" 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" id="getport-1"><span class="tsd-kind-call-signature">getPort</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getport-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L283">src/Application.ts:283</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getprogram"><span>get<wbr/>Program</span><a href="#getprogram" 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" id="getprogram-1"><span class="tsd-kind-call-signature">getProgram</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Command</span><a href="#getprogram-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Command</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L326">src/Application.ts:326</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getrequestsizelimit"><span>get<wbr/>Request<wbr/>Size<wbr/>Limit</span><a href="#getrequestsizelimit" 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" id="getrequestsizelimit-1"><span class="tsd-kind-call-signature">getRequestSizeLimit</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getrequestsizelimit-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>The maximum size limit for incoming requests that this service needs to handle.</p>
|
|
132
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L341">src/Application.ts:341</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="gettokenmanager"><span>get<wbr/>Token<wbr/>Manager</span><a href="#gettokenmanager" 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" id="gettokenmanager-1"><span class="tsd-kind-call-signature">getTokenManager</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="TokenManager.html" class="tsd-signature-type tsd-kind-class">TokenManager</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><span class="tsd-signature-symbol">></span><a href="#gettokenmanager-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"><h4 class="tsd-returns-title">Returns <a href="TokenManager.html" class="tsd-signature-type tsd-kind-class">TokenManager</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><span class="tsd-signature-symbol">></span></h4><p>the token manager</p>
|
|
133
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L512">src/Application.ts:512</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getversion"><span>get<wbr/>Version</span><a href="#getversion" 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" id="getversion-1"><span class="tsd-kind-call-signature">getVersion</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#getversion-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L294">src/Application.ts:294</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="listenercount"><span>listener<wbr/>Count</span><a href="#listenercount" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="listenercount-1"><span class="tsd-kind-call-signature">listenerCount</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenercountk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><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>.
|
|
134
134
|
If <code>listener</code> is provided, it will return how many times the listener is found
|
|
135
135
|
in the list of the listeners of the event.</p>
|
|
136
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
136
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="listenercountk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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>
|
|
137
137
|
</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>
|
|
138
|
-
</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"
|
|
139
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/@types/node/events.d.ts:868</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
140
|
-
<pre><code class="js"><span class="hl-
|
|
138
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-8">Since<a href="#since-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v3.2.0</p>
|
|
139
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in node_modules/@types/node/events.d.ts:868</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="listeners"><span>listeners</span><a href="#listeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="listeners-1"><span class="tsd-kind-call-signature">listeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#listenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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>
|
|
140
|
+
<pre><code class="js"><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'someone connected!'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">util</span><span class="hl-3">.</span><span class="hl-5">inspect</span><span class="hl-3">(</span><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">listeners</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">)));</span><br/><span class="hl-8">// Prints: [ [Function] ]</span>
|
|
141
141
|
</code><button type="button">Copy</button></pre>
|
|
142
142
|
|
|
143
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
144
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:787</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><
|
|
145
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="
|
|
146
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
147
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
148
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.off</p><ul><li>Defined in node_modules/@types/node/events.d.ts:747</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
143
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="listenersk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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" id="since-9">Since<a href="#since-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.26</p>
|
|
144
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:787</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="loadconfig"><span class="deprecated">load<wbr/>Config</span><a href="#loadconfig" 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" id="loadconfig-1"><span class="tsd-kind-call-signature">loadConfig</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">path</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-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">></span><a href="#loadconfig-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-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The directory path that contains bt-config.json and bt-local-config.json</p>
|
|
145
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtconfig">TConfig</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-deprecated"><h4 class="tsd-anchor-link" id="deprecated-1">Deprecated<a href="#deprecated-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>Supply the configs via --config and --local-config arguments</p>
|
|
146
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L412">src/Application.ts:412</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="off"><span>off</span><a href="#off" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="off-1"><span class="tsd-kind-call-signature">off</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#offk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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">=></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>
|
|
147
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="offk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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">=></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" id="since-10">Since<a href="#since-10" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v10.0.0</p>
|
|
148
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.off</p><ul><li>Defined in node_modules/@types/node/events.d.ts:747</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="on"><span>on</span><a href="#on" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="on-1"><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#onk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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">=></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
|
|
149
149
|
named <code>eventName</code>. No checks are made to see if the <code>listener</code> has already
|
|
150
150
|
been added. Multiple calls passing the same combination of <code>eventName</code> and
|
|
151
151
|
<code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
|
|
152
|
-
<pre><code class="js"><span class="hl-
|
|
152
|
+
<pre><code class="js"><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'someone connected!'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span>
|
|
153
153
|
</code><button type="button">Copy</button></pre>
|
|
154
154
|
|
|
155
155
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
156
156
|
<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
|
|
157
157
|
event listener to the beginning of the listeners array.</p>
|
|
158
|
-
<pre><code class="js"><span class="hl-
|
|
158
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEE</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'a'</span><span class="hl-3">));</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">prependListener</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'b'</span><span class="hl-3">));</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">);</span><br/><span class="hl-8">// Prints:</span><br/><span class="hl-8">// b</span><br/><span class="hl-8">// a</span>
|
|
159
159
|
</code><button type="button">Copy</button></pre>
|
|
160
160
|
|
|
161
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
161
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="onk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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>
|
|
162
162
|
</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">=></span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
163
|
-
</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"
|
|
164
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/@types/node/events.d.ts:629</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
163
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-11">Since<a href="#since-11" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.1.101</p>
|
|
164
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in node_modules/@types/node/events.d.ts:629</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="once"><span>once</span><a href="#once" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="once-1"><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#oncek">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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">=></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
|
|
165
165
|
next time <code>eventName</code> is triggered, this listener is removed and then invoked.</p>
|
|
166
|
-
<pre><code class="js"><span class="hl-
|
|
166
|
+
<pre><code class="js"><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'Ah, we have our first user!'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span>
|
|
167
167
|
</code><button type="button">Copy</button></pre>
|
|
168
168
|
|
|
169
169
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
170
170
|
<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
|
|
171
171
|
event listener to the beginning of the listeners array.</p>
|
|
172
|
-
<pre><code class="js"><span class="hl-
|
|
172
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEE</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'a'</span><span class="hl-3">));</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">prependOnceListener</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'b'</span><span class="hl-3">));</span><br/><span class="hl-4">myEE</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">);</span><br/><span class="hl-8">// Prints:</span><br/><span class="hl-8">// b</span><br/><span class="hl-8">// a</span>
|
|
173
173
|
</code><button type="button">Copy</button></pre>
|
|
174
174
|
|
|
175
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
175
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="oncek"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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>
|
|
176
176
|
</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">=></span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
177
|
-
</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"
|
|
178
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/@types/node/events.d.ts:659</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
177
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-12">Since<a href="#since-12" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v0.3.0</p>
|
|
178
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in node_modules/@types/node/events.d.ts:659</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="prependlistener"><span>prepend<wbr/>Listener</span><a href="#prependlistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="prependlistener-1"><span class="tsd-kind-call-signature">prependListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependlistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><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">=></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
|
|
179
179
|
event named <code>eventName</code>. No checks are made to see if the <code>listener</code> has
|
|
180
180
|
already been added. Multiple calls passing the same combination of <code>eventName</code>
|
|
181
181
|
and <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
|
|
182
|
-
<pre><code class="js"><span class="hl-
|
|
182
|
+
<pre><code class="js"><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">prependListener</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'someone connected!'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span>
|
|
183
183
|
</code><button type="button">Copy</button></pre>
|
|
184
184
|
|
|
185
185
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
186
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
186
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="prependlistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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>
|
|
187
187
|
</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">=></span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
188
|
-
</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"
|
|
189
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:886</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
188
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-13">Since<a href="#since-13" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
|
189
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:886</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="prependoncelistener"><span>prepend<wbr/>Once<wbr/>Listener</span><a href="#prependoncelistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="prependoncelistener-1"><span class="tsd-kind-call-signature">prependOnceListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#prependoncelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><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">=></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
|
|
190
190
|
listener is removed, and then invoked.</p>
|
|
191
|
-
<pre><code class="js"><span class="hl-
|
|
191
|
+
<pre><code class="js"><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">prependOnceListener</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'Ah, we have our first user!'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span>
|
|
192
192
|
</code><button type="button">Copy</button></pre>
|
|
193
193
|
|
|
194
194
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
195
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
195
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="prependoncelistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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>
|
|
196
196
|
</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">=></span> <span class="tsd-signature-type">void</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
197
|
-
</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"
|
|
198
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependOnceListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:902</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
197
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-14">Since<a href="#since-14" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v6.0.0</p>
|
|
198
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.prependOnceListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:902</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="rawlisteners"><span>raw<wbr/>Listeners</span><a href="#rawlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="rawlisteners-1"><span class="tsd-kind-call-signature">rawListeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#rawlistenersk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">:</span> <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>,
|
|
199
199
|
including any wrappers (such as those created by <code>.once()</code>).</p>
|
|
200
|
-
<pre><code class="js"><span class="hl-
|
|
200
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">emitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-1">'log'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'log once'</span><span class="hl-3">));</span><br/><br/><span class="hl-8">// Returns a new Array with a function `onceWrapper` which has a property</span><br/><span class="hl-8">// `listener` which contains the original listener bound above</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">listeners</span><span class="hl-3"> = </span><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">rawListeners</span><span class="hl-3">(</span><span class="hl-1">'log'</span><span class="hl-3">);</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">logFnWrapper</span><span class="hl-3"> = </span><span class="hl-4">listeners</span><span class="hl-3">[</span><span class="hl-2">0</span><span class="hl-3">];</span><br/><br/><span class="hl-8">// Logs "log once" to the console and does not unbind the `once` event</span><br/><span class="hl-4">logFnWrapper</span><span class="hl-3">.</span><span class="hl-5">listener</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// Logs "log once" to the console and removes the listener</span><br/><span class="hl-5">logFnWrapper</span><span class="hl-3">();</span><br/><br/><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'log'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'log persistently'</span><span class="hl-3">));</span><br/><span class="hl-8">// Will return a new Array with a single function bound by `.on()` above</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">newListeners</span><span class="hl-3"> = </span><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">rawListeners</span><span class="hl-3">(</span><span class="hl-1">'log'</span><span class="hl-3">);</span><br/><br/><span class="hl-8">// Logs "log persistently" twice</span><br/><span class="hl-4">newListeners</span><span class="hl-3">[</span><span class="hl-2">0</span><span class="hl-3">]();</span><br/><span class="hl-4">emitter</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'log'</span><span class="hl-3">);</span>
|
|
201
201
|
</code><button type="button">Copy</button></pre>
|
|
202
202
|
|
|
203
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
204
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.rawListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:818</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
203
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="rawlistenersk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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" id="since-15">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>
|
|
204
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.rawListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:818</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="removealllisteners"><span>remove<wbr/>All<wbr/>Listeners</span><a href="#removealllisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="removealllisteners-1"><span class="tsd-kind-call-signature">removeAllListeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">?:</span> <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>
|
|
205
205
|
<p>It is bad practice to remove listeners added elsewhere in the code,
|
|
206
206
|
particularly when the <code>EventEmitter</code> instance was created by some other
|
|
207
207
|
component or module (e.g. sockets or file streams).</p>
|
|
208
208
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
209
|
-
</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"
|
|
210
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeAllListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:758</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
211
|
-
<pre><code class="js"><span class="hl-
|
|
209
|
+
</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" id="since-16">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>
|
|
210
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeAllListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:758</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="removelistener"><span>remove<wbr/>Listener</span><a href="#removelistener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="removelistener-1"><span class="tsd-kind-call-signature">removeListener</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#removelistenerk">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><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">=></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>
|
|
211
|
+
<pre><code class="js"><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-5">callback</span><span class="hl-3"> = (</span><span class="hl-4">stream</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'someone connected!'</span><span class="hl-3">);</span><br/><span class="hl-3">};</span><br/><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, </span><span class="hl-4">callback</span><span class="hl-3">);</span><br/><span class="hl-8">// ...</span><br/><span class="hl-4">server</span><span class="hl-3">.</span><span class="hl-5">removeListener</span><span class="hl-3">(</span><span class="hl-1">'connection'</span><span class="hl-3">, </span><span class="hl-4">callback</span><span class="hl-3">);</span>
|
|
212
212
|
</code><button type="button">Copy</button></pre>
|
|
213
213
|
|
|
214
214
|
<p><code>removeListener()</code> will remove, at most, one instance of a listener from the
|
|
@@ -218,7 +218,7 @@ called multiple times to remove each instance.</p>
|
|
|
218
218
|
<p>Once an event is emitted, all listeners attached to it at the
|
|
219
219
|
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
|
|
220
220
|
will not remove them from<code>emit()</code> in progress. Subsequent events behave as expected.</p>
|
|
221
|
-
<pre><code class="js"><span class="hl-
|
|
221
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">class</span><span class="hl-3"> </span><span class="hl-9">MyEmitter</span><span class="hl-3"> </span><span class="hl-0">extends</span><span class="hl-3"> </span><span class="hl-9">EventEmitter</span><span class="hl-3"> {}</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEmitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">MyEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-5">callbackA</span><span class="hl-3"> = () </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'A'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">removeListener</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-4">callbackB</span><span class="hl-3">);</span><br/><span class="hl-3">};</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-5">callbackB</span><span class="hl-3"> = () </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'B'</span><span class="hl-3">);</span><br/><span class="hl-3">};</span><br/><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-4">callbackA</span><span class="hl-3">);</span><br/><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, </span><span class="hl-4">callbackB</span><span class="hl-3">);</span><br/><br/><span class="hl-8">// callbackA removes listener callbackB but it will still be called.</span><br/><span class="hl-8">// Internal listener array at time of emit [callbackA, callbackB]</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">);</span><br/><span class="hl-8">// Prints:</span><br/><span class="hl-8">// A</span><br/><span class="hl-8">// B</span><br/><br/><span class="hl-8">// callbackB is now removed.</span><br/><span class="hl-8">// Internal listener array [callbackA]</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">);</span><br/><span class="hl-8">// Prints:</span><br/><span class="hl-8">// A</span>
|
|
222
222
|
</code><button type="button">Copy</button></pre>
|
|
223
223
|
|
|
224
224
|
<p>Because listeners are managed using an internal array, calling this will
|
|
@@ -229,20 +229,20 @@ the <code>emitter.listeners()</code> method will need to be recreated.</p>
|
|
|
229
229
|
<p>When a single function has been added as a handler multiple times for a single
|
|
230
230
|
event (as in the example below), <code>removeListener()</code> will remove the most
|
|
231
231
|
recently added instance. In the example the <code>once('ping')</code> listener is removed:</p>
|
|
232
|
-
<pre><code class="js"><span class="hl-
|
|
232
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">pong</span><span class="hl-3">() {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'pong'</span><span class="hl-3">);</span><br/><span class="hl-3">}</span><br/><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'ping'</span><span class="hl-3">, </span><span class="hl-4">pong</span><span class="hl-3">);</span><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-1">'ping'</span><span class="hl-3">, </span><span class="hl-4">pong</span><span class="hl-3">);</span><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">removeListener</span><span class="hl-3">(</span><span class="hl-1">'ping'</span><span class="hl-3">, </span><span class="hl-4">pong</span><span class="hl-3">);</span><br/><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'ping'</span><span class="hl-3">);</span><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'ping'</span><span class="hl-3">);</span>
|
|
233
233
|
</code><button type="button">Copy</button></pre>
|
|
234
234
|
|
|
235
235
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
236
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span
|
|
237
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:742</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><
|
|
236
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="removelistenerk"><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <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">=></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" id="since-17">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>
|
|
237
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.removeListener</p><ul><li>Defined in node_modules/@types/node/events.d.ts:742</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="setmaxlisteners"><span>set<wbr/>Max<wbr/>Listeners</span><a href="#setmaxlisteners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="setmaxlisteners-1"><span class="tsd-kind-call-signature">setMaxListeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">n</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#setmaxlisteners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>By default <code>EventEmitter</code>s will print a warning if more than <code>10</code> listeners are
|
|
238
238
|
added for a particular event. This is a useful default that helps finding
|
|
239
239
|
memory leaks. The <code>emitter.setMaxListeners()</code> method allows the limit to be
|
|
240
240
|
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>
|
|
241
241
|
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
242
|
-
</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"
|
|
243
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:768</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><
|
|
244
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">tokenManager</span>: <a href="TokenManager.html" class="tsd-signature-type tsd-kind-class">TokenManager</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="
|
|
245
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
242
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">n</span>: <span class="tsd-signature-type">number</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-18">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>
|
|
243
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in node_modules/@types/node/events.d.ts:768</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="settokenmanager"><span>set<wbr/>Token<wbr/>Manager</span><a href="#settokenmanager" 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" id="settokenmanager-1"><span class="tsd-kind-call-signature">setTokenManager</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">tokenManager</span><span class="tsd-signature-symbol">:</span> <a href="TokenManager.html" class="tsd-signature-type tsd-kind-class">TokenManager</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><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="#settokenmanager-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>Sets the TokenManager to be used for authentication.</p>
|
|
244
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">tokenManager</span>: <a href="TokenManager.html" class="tsd-signature-type tsd-kind-class">TokenManager</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#constructorapplicationtauthtoken">TAuthToken</a><span class="tsd-signature-symbol">></span></span><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/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L505">src/Application.ts:505</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="shouldlisten"><span>should<wbr/>Listen</span><a href="#shouldlisten" 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" id="shouldlisten-1"><span class="tsd-kind-call-signature">shouldListen</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#shouldlisten-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p>true if the Application should bind to an IP address</p>
|
|
245
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L490">src/Application.ts:490</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="start"><span>start</span><a href="#start" 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" id="start-1"><span class="tsd-kind-call-signature">start</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#start-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"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/d1f7b6e5c47e4e6ee4db0119405b3963f9309836/src/Application.ts#L123">src/Application.ts:123</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="addabortlistener"><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" id="addabortlistener-1"><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">=></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>
|
|
246
246
|
<p>Listening to the <code>abort</code> event on abort signals is unsafe and may
|
|
247
247
|
lead to resource leaks since another third party with the signal can
|
|
248
248
|
call <code>e.stopImmediatePropagation()</code>. Unfortunately Node.js cannot change
|
|
@@ -252,39 +252,39 @@ API makes it easy to forget to remove listeners.</p>
|
|
|
252
252
|
two issues by listening to the event such that <code>stopImmediatePropagation</code> does
|
|
253
253
|
not prevent the listener from running.</p>
|
|
254
254
|
<p>Returns a disposable so that it may be unsubscribed from more easily.</p>
|
|
255
|
-
<pre><code class="js"><span class="hl-
|
|
255
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">addAbortListener</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">example</span><span class="hl-3">(</span><span class="hl-4">signal</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-0">let</span><span class="hl-3"> </span><span class="hl-4">disposable</span><span class="hl-3">;</span><br/><span class="hl-3"> </span><span class="hl-6">try</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">signal</span><span class="hl-3">.</span><span class="hl-5">addEventListener</span><span class="hl-3">(</span><span class="hl-1">'abort'</span><span class="hl-3">, (</span><span class="hl-4">e</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">e</span><span class="hl-3">.</span><span class="hl-5">stopImmediatePropagation</span><span class="hl-3">());</span><br/><span class="hl-3"> </span><span class="hl-4">disposable</span><span class="hl-3"> = </span><span class="hl-5">addAbortListener</span><span class="hl-3">(</span><span class="hl-4">signal</span><span class="hl-3">, (</span><span class="hl-4">e</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-8">// Do something when signal is aborted.</span><br/><span class="hl-3"> });</span><br/><span class="hl-3"> } </span><span class="hl-6">finally</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">disposable</span><span class="hl-3">?.[</span><span class="hl-4">Symbol</span><span class="hl-3">.</span><span class="hl-4">dispose</span><span class="hl-3">]();</span><br/><span class="hl-3"> }</span><br/><span class="hl-3">}</span>
|
|
256
256
|
</code><button type="button">Copy</button></pre>
|
|
257
257
|
|
|
258
258
|
</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">=></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>
|
|
259
|
-
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
260
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addAbortListener</p><ul><li>Defined in 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"><
|
|
259
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-19">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>
|
|
260
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.addAbortListener</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="geteventlisteners"><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" id="geteventlisteners-1"><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">EventTarget</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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>
|
|
261
261
|
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.listeners</code> on
|
|
262
262
|
the emitter.</p>
|
|
263
263
|
<p>For <code>EventTarget</code>s this is the only way to get the event listeners for the
|
|
264
264
|
event target. This is useful for debugging and diagnostic purposes.</p>
|
|
265
|
-
<pre><code class="js"><span class="hl-
|
|
265
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">getEventListeners</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-3">{</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-5">listener</span><span class="hl-3"> = () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'Events are fun'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-4">listener</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getEventListeners</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">)); </span><span class="hl-8">// [ [Function: listener] ]</span><br/><span class="hl-3">}</span><br/><span class="hl-3">{</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">et</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventTarget</span><span class="hl-3">();</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-5">listener</span><span class="hl-3"> = () </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'Events are fun'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">et</span><span class="hl-3">.</span><span class="hl-5">addEventListener</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-4">listener</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getEventListeners</span><span class="hl-3">(</span><span class="hl-4">et</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">)); </span><span class="hl-8">// [ [Function: listener] ]</span><br/><span class="hl-3">}</span>
|
|
266
266
|
</code><button type="button">Copy</button></pre>
|
|
267
267
|
|
|
268
|
-
</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 class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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"
|
|
269
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getEventListeners</p><ul><li>Defined in 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"><
|
|
268
|
+
</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 class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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" id="since-20">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>
|
|
269
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getEventListeners</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="getmaxlisteners-2"><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" id="getmaxlisteners-3"><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">EventTarget</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getmaxlisteners-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>
|
|
270
270
|
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.getMaxListeners</code> on
|
|
271
271
|
the emitter.</p>
|
|
272
272
|
<p>For <code>EventTarget</code>s this is the only way to get the max event listeners for the
|
|
273
273
|
event target. If the number of event handlers on a single EventTarget exceeds
|
|
274
274
|
the max set, the EventTarget will print a warning.</p>
|
|
275
|
-
<pre><code class="js"><span class="hl-
|
|
275
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">getMaxListeners</span><span class="hl-3">, </span><span class="hl-4">setMaxListeners</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-3">{</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getMaxListeners</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">)); </span><span class="hl-8">// 10</span><br/><span class="hl-3"> </span><span class="hl-5">setMaxListeners</span><span class="hl-3">(</span><span class="hl-2">11</span><span class="hl-3">, </span><span class="hl-4">ee</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getMaxListeners</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">)); </span><span class="hl-8">// 11</span><br/><span class="hl-3">}</span><br/><span class="hl-3">{</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">et</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventTarget</span><span class="hl-3">();</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getMaxListeners</span><span class="hl-3">(</span><span class="hl-4">et</span><span class="hl-3">)); </span><span class="hl-8">// 10</span><br/><span class="hl-3"> </span><span class="hl-5">setMaxListeners</span><span class="hl-3">(</span><span class="hl-2">11</span><span class="hl-3">, </span><span class="hl-4">et</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">getMaxListeners</span><span class="hl-3">(</span><span class="hl-4">et</span><span class="hl-3">)); </span><span class="hl-8">// 11</span><br/><span class="hl-3">}</span>
|
|
276
276
|
</code><button type="button">Copy</button></pre>
|
|
277
277
|
|
|
278
|
-
</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 class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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"
|
|
279
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in 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"><
|
|
280
|
-
<pre><code class="js"><span class="hl-
|
|
278
|
+
</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 class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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" id="since-21">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>
|
|
279
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.getMaxListeners</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="listenercount-2"><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" id="listenercount-3"><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>
|
|
280
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3">, </span><span class="hl-4">listenerCount</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">myEmitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {});</span><br/><span class="hl-4">myEmitter</span><span class="hl-3">.</span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-1">'event'</span><span class="hl-3">, () </span><span class="hl-0">=></span><span class="hl-3"> {});</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-5">listenerCount</span><span class="hl-3">(</span><span class="hl-4">myEmitter</span><span class="hl-3">, </span><span class="hl-1">'event'</span><span class="hl-3">));</span><br/><span class="hl-8">// Prints: 2</span>
|
|
281
281
|
</code><button type="button">Copy</button></pre>
|
|
282
282
|
|
|
283
283
|
</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>
|
|
284
284
|
</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>
|
|
285
|
-
</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"
|
|
286
|
-
</div><div class="tsd-tag-deprecated"><h4 class="tsd-anchor-link"
|
|
287
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in 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"><
|
|
285
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-22">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>
|
|
286
|
+
</div><div class="tsd-tag-deprecated"><h4 class="tsd-anchor-link" id="deprecated-2">Deprecated<a href="#deprecated-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>Since v3.2.0 - Use <code>listenerCount</code> instead.</p>
|
|
287
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.listenerCount</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="on-2"><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" id="on-3"><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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></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-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// Emit later on</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">)) {</span><br/><span class="hl-3"> </span><span class="hl-8">// The execution of this inner block is synchronous and it</span><br/><span class="hl-3"> </span><span class="hl-8">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-3"> </span><span class="hl-8">// if concurrent execution is required.</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3">}</span><br/><span class="hl-8">// Unreachable here</span>
|
|
288
288
|
</code><button type="button">Copy</button></pre>
|
|
289
289
|
|
|
290
290
|
<p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
|
|
@@ -292,16 +292,16 @@ if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all list
|
|
|
292
292
|
exiting the loop. The <code>value</code> returned by each iteration is an array
|
|
293
293
|
composed of the emitted event arguments.</p>
|
|
294
294
|
<p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
|
|
295
|
-
<pre><code class="js"><span class="hl-
|
|
295
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ac</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">AbortController</span><span class="hl-3">();</span><br/><br/><span class="hl-3">(</span><span class="hl-0">async</span><span class="hl-3"> () </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-3"> </span><span class="hl-8">// Emit later on</span><br/><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3"> });</span><br/><br/><span class="hl-3"> </span><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, { </span><span class="hl-4">signal:</span><span class="hl-3"> </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-4">signal</span><span class="hl-3"> })) {</span><br/><span class="hl-3"> </span><span class="hl-8">// The execution of this inner block is synchronous and it</span><br/><span class="hl-3"> </span><span class="hl-8">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-3"> </span><span class="hl-8">// if concurrent execution is required.</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3"> }</span><br/><span class="hl-3"> </span><span class="hl-8">// Unreachable here</span><br/><span class="hl-3">})();</span><br/><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-5">abort</span><span class="hl-3">());</span>
|
|
296
296
|
</code><button type="button">Copy</button></pre>
|
|
297
297
|
|
|
298
298
|
<p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
|
|
299
|
-
<pre><code class="js"><span class="hl-
|
|
299
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// Emit later on</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'close'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, { </span><span class="hl-4">close:</span><span class="hl-3"> [</span><span class="hl-1">'close'</span><span class="hl-3">] })) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3">}</span><br/><span class="hl-8">// the loop will exit after 'close' is emitted</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'done'</span><span class="hl-3">); </span><span class="hl-8">// prints 'done'</span>
|
|
300
300
|
</code><button type="button">Copy</button></pre>
|
|
301
301
|
|
|
302
302
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventEmitter</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">StaticEventEmitterIteratorOptions</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncIterator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
|
|
303
|
-
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
304
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in 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"
|
|
303
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-23">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>
|
|
304
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in 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" id="on-4"><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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></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-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// Emit later on</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">)) {</span><br/><span class="hl-3"> </span><span class="hl-8">// The execution of this inner block is synchronous and it</span><br/><span class="hl-3"> </span><span class="hl-8">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-3"> </span><span class="hl-8">// if concurrent execution is required.</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3">}</span><br/><span class="hl-8">// Unreachable here</span>
|
|
305
305
|
</code><button type="button">Copy</button></pre>
|
|
306
306
|
|
|
307
307
|
<p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
|
|
@@ -309,60 +309,60 @@ if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all list
|
|
|
309
309
|
exiting the loop. The <code>value</code> returned by each iteration is an array
|
|
310
310
|
composed of the emitted event arguments.</p>
|
|
311
311
|
<p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
|
|
312
|
-
<pre><code class="js"><span class="hl-
|
|
312
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ac</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">AbortController</span><span class="hl-3">();</span><br/><br/><span class="hl-3">(</span><span class="hl-0">async</span><span class="hl-3"> () </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-3"> </span><span class="hl-8">// Emit later on</span><br/><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3"> });</span><br/><br/><span class="hl-3"> </span><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, { </span><span class="hl-4">signal:</span><span class="hl-3"> </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-4">signal</span><span class="hl-3"> })) {</span><br/><span class="hl-3"> </span><span class="hl-8">// The execution of this inner block is synchronous and it</span><br/><span class="hl-3"> </span><span class="hl-8">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-3"> </span><span class="hl-8">// if concurrent execution is required.</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3"> }</span><br/><span class="hl-3"> </span><span class="hl-8">// Unreachable here</span><br/><span class="hl-3">})();</span><br/><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-5">abort</span><span class="hl-3">());</span>
|
|
313
313
|
</code><button type="button">Copy</button></pre>
|
|
314
314
|
|
|
315
315
|
<p>Use the <code>close</code> option to specify an array of event names that will end the iteration:</p>
|
|
316
|
-
<pre><code class="js"><span class="hl-
|
|
316
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">on</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-8">// Emit later on</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-1">'bar'</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'close'</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">for</span><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> (</span><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">event</span><span class="hl-3"> </span><span class="hl-0">of</span><span class="hl-3"> </span><span class="hl-5">on</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, { </span><span class="hl-4">close:</span><span class="hl-3"> [</span><span class="hl-1">'close'</span><span class="hl-3">] })) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">event</span><span class="hl-3">); </span><span class="hl-8">// prints ['bar'] [42]</span><br/><span class="hl-3">}</span><br/><span class="hl-8">// the loop will exit after 'close' is emitted</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'done'</span><span class="hl-3">); </span><span class="hl-8">// prints 'done'</span>
|
|
317
317
|
</code><button type="button">Copy</button></pre>
|
|
318
318
|
|
|
319
319
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
|
|
320
|
-
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
321
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in 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"><
|
|
320
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-24">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>
|
|
321
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.on</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="once-2"><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" id="once-3"><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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></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
|
|
322
322
|
event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
|
|
323
323
|
The <code>Promise</code> will resolve with an array of all the arguments emitted to the
|
|
324
324
|
given event.</p>
|
|
325
325
|
<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
|
|
326
326
|
semantics and does not listen to the <code>'error'</code> event.</p>
|
|
327
|
-
<pre><code class="js"><span class="hl-
|
|
327
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">once</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'myevent'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> [</span><span class="hl-7">value</span><span class="hl-3">] = </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'myevent'</span><span class="hl-3">);</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">value</span><span class="hl-3">);</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">err</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">Error</span><span class="hl-3">(</span><span class="hl-1">'kaboom'</span><span class="hl-3">);</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">try</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'myevent'</span><span class="hl-3">);</span><br/><span class="hl-3">} </span><span class="hl-6">catch</span><span class="hl-3"> (</span><span class="hl-4">err</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'error happened'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">);</span><br/><span class="hl-3">}</span>
|
|
328
328
|
</code><button type="button">Copy</button></pre>
|
|
329
329
|
|
|
330
330
|
<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
|
|
331
331
|
'<code>error'</code> event itself, then it is treated as any other kind of event without
|
|
332
332
|
special handling:</p>
|
|
333
|
-
<pre><code class="js"><span class="hl-
|
|
333
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3">, </span><span class="hl-4">once</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'error'</span><span class="hl-3">)</span><br/><span class="hl-3"> .</span><span class="hl-5">then</span><span class="hl-3">(([</span><span class="hl-4">err</span><span class="hl-3">]) </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'ok'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">))</span><br/><span class="hl-3"> .</span><span class="hl-5">catch</span><span class="hl-3">((</span><span class="hl-4">err</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">));</span><br/><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">Error</span><span class="hl-3">(</span><span class="hl-1">'boom'</span><span class="hl-3">));</span><br/><br/><span class="hl-8">// Prints: ok boom</span>
|
|
334
334
|
</code><button type="button">Copy</button></pre>
|
|
335
335
|
|
|
336
336
|
<p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
|
|
337
|
-
<pre><code class="js"><span class="hl-
|
|
337
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3">, </span><span class="hl-4">once</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ac</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">AbortController</span><span class="hl-3">();</span><br/><br/><span class="hl-0">async</span><span class="hl-3"> </span><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">foo</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">, </span><span class="hl-4">event</span><span class="hl-3">, </span><span class="hl-4">signal</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-6">try</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">, </span><span class="hl-4">event</span><span class="hl-3">, { </span><span class="hl-4">signal</span><span class="hl-3"> });</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'event emitted!'</span><span class="hl-3">);</span><br/><span class="hl-3"> } </span><span class="hl-6">catch</span><span class="hl-3"> (</span><span class="hl-4">error</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-6">if</span><span class="hl-3"> (</span><span class="hl-4">error</span><span class="hl-3">.</span><span class="hl-4">name</span><span class="hl-3"> === </span><span class="hl-1">'AbortError'</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'Waiting for the event was canceled!'</span><span class="hl-3">);</span><br/><span class="hl-3"> } </span><span class="hl-6">else</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'There was an error'</span><span class="hl-3">, </span><span class="hl-4">error</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">);</span><br/><span class="hl-3"> }</span><br/><span class="hl-3"> }</span><br/><span class="hl-3">}</span><br/><br/><span class="hl-5">foo</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-4">signal</span><span class="hl-3">);</span><br/><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-5">abort</span><span class="hl-3">(); </span><span class="hl-8">// Abort waiting for the event</span><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">); </span><span class="hl-8">// Prints: Waiting for the event was canceled!</span>
|
|
338
338
|
</code><button type="button">Copy</button></pre>
|
|
339
339
|
|
|
340
|
-
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
341
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in 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"
|
|
340
|
+
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-25">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>
|
|
341
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in 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" id="once-4"><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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></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
|
|
342
342
|
event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
|
|
343
343
|
The <code>Promise</code> will resolve with an array of all the arguments emitted to the
|
|
344
344
|
given event.</p>
|
|
345
345
|
<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
|
|
346
346
|
semantics and does not listen to the <code>'error'</code> event.</p>
|
|
347
|
-
<pre><code class="js"><span class="hl-
|
|
347
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">once</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><span class="hl-6">import</span><span class="hl-3"> </span><span class="hl-4">process</span><span class="hl-3"> </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:process'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'myevent'</span><span class="hl-3">, </span><span class="hl-2">42</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> [</span><span class="hl-7">value</span><span class="hl-3">] = </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'myevent'</span><span class="hl-3">);</span><br/><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-4">value</span><span class="hl-3">);</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">err</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">Error</span><span class="hl-3">(</span><span class="hl-1">'kaboom'</span><span class="hl-3">);</span><br/><span class="hl-4">process</span><span class="hl-3">.</span><span class="hl-5">nextTick</span><span class="hl-3">(() </span><span class="hl-0">=></span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">);</span><br/><span class="hl-3">});</span><br/><br/><span class="hl-6">try</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'myevent'</span><span class="hl-3">);</span><br/><span class="hl-3">} </span><span class="hl-6">catch</span><span class="hl-3"> (</span><span class="hl-4">err</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'error happened'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">);</span><br/><span class="hl-3">}</span>
|
|
348
348
|
</code><button type="button">Copy</button></pre>
|
|
349
349
|
|
|
350
350
|
<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
|
|
351
351
|
'<code>error'</code> event itself, then it is treated as any other kind of event without
|
|
352
352
|
special handling:</p>
|
|
353
|
-
<pre><code class="js"><span class="hl-
|
|
353
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3">, </span><span class="hl-4">once</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'error'</span><span class="hl-3">)</span><br/><span class="hl-3"> .</span><span class="hl-5">then</span><span class="hl-3">(([</span><span class="hl-4">err</span><span class="hl-3">]) </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'ok'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">))</span><br/><span class="hl-3"> .</span><span class="hl-5">catch</span><span class="hl-3">((</span><span class="hl-4">err</span><span class="hl-3">) </span><span class="hl-0">=></span><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-4">err</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">));</span><br/><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'error'</span><span class="hl-3">, </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">Error</span><span class="hl-3">(</span><span class="hl-1">'boom'</span><span class="hl-3">));</span><br/><br/><span class="hl-8">// Prints: ok boom</span>
|
|
354
354
|
</code><button type="button">Copy</button></pre>
|
|
355
355
|
|
|
356
356
|
<p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
|
|
357
|
-
<pre><code class="js"><span class="hl-
|
|
357
|
+
<pre><code class="js"><span class="hl-6">import</span><span class="hl-3"> { </span><span class="hl-4">EventEmitter</span><span class="hl-3">, </span><span class="hl-4">once</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ee</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">ac</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">AbortController</span><span class="hl-3">();</span><br/><br/><span class="hl-0">async</span><span class="hl-3"> </span><span class="hl-0">function</span><span class="hl-3"> </span><span class="hl-5">foo</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">, </span><span class="hl-4">event</span><span class="hl-3">, </span><span class="hl-4">signal</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-6">try</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-6">await</span><span class="hl-3"> </span><span class="hl-5">once</span><span class="hl-3">(</span><span class="hl-4">emitter</span><span class="hl-3">, </span><span class="hl-4">event</span><span class="hl-3">, { </span><span class="hl-4">signal</span><span class="hl-3"> });</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">log</span><span class="hl-3">(</span><span class="hl-1">'event emitted!'</span><span class="hl-3">);</span><br/><span class="hl-3"> } </span><span class="hl-6">catch</span><span class="hl-3"> (</span><span class="hl-4">error</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-6">if</span><span class="hl-3"> (</span><span class="hl-4">error</span><span class="hl-3">.</span><span class="hl-4">name</span><span class="hl-3"> === </span><span class="hl-1">'AbortError'</span><span class="hl-3">) {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'Waiting for the event was canceled!'</span><span class="hl-3">);</span><br/><span class="hl-3"> } </span><span class="hl-6">else</span><span class="hl-3"> {</span><br/><span class="hl-3"> </span><span class="hl-4">console</span><span class="hl-3">.</span><span class="hl-5">error</span><span class="hl-3">(</span><span class="hl-1">'There was an error'</span><span class="hl-3">, </span><span class="hl-4">error</span><span class="hl-3">.</span><span class="hl-4">message</span><span class="hl-3">);</span><br/><span class="hl-3"> }</span><br/><span class="hl-3"> }</span><br/><span class="hl-3">}</span><br/><br/><span class="hl-5">foo</span><span class="hl-3">(</span><span class="hl-4">ee</span><span class="hl-3">, </span><span class="hl-1">'foo'</span><span class="hl-3">, </span><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-4">signal</span><span class="hl-3">);</span><br/><span class="hl-4">ac</span><span class="hl-3">.</span><span class="hl-5">abort</span><span class="hl-3">(); </span><span class="hl-8">// Abort waiting for the event</span><br/><span class="hl-4">ee</span><span class="hl-3">.</span><span class="hl-5">emit</span><span class="hl-3">(</span><span class="hl-1">'foo'</span><span class="hl-3">); </span><span class="hl-8">// Prints: Waiting for the event was canceled!</span>
|
|
358
358
|
</code><button type="button">Copy</button></pre>
|
|
359
359
|
|
|
360
|
-
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link"
|
|
361
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in 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"><
|
|
360
|
+
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-26">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>
|
|
361
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.once</p><ul><li>Defined in 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"><h3 class="tsd-anchor-link" id="setmaxlisteners-2"><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" id="setmaxlisteners-3"><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">EventTarget</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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-6">import</span><span class="hl-3"> { </span><span class="hl-4">setMaxListeners</span><span class="hl-3">, </span><span class="hl-4">EventEmitter</span><span class="hl-3"> } </span><span class="hl-6">from</span><span class="hl-3"> </span><span class="hl-1">'node:events'</span><span class="hl-3">;</span><br/><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">target</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventTarget</span><span class="hl-3">();</span><br/><span class="hl-0">const</span><span class="hl-3"> </span><span class="hl-7">emitter</span><span class="hl-3"> = </span><span class="hl-0">new</span><span class="hl-3"> </span><span class="hl-5">EventEmitter</span><span class="hl-3">();</span><br/><br/><span class="hl-5">setMaxListeners</span><span class="hl-3">(</span><span class="hl-2">5</span><span class="hl-3">, </span><span class="hl-4">target</span><span class="hl-3">, </span><span class="hl-4">emitter</span><span class="hl-3">);</span>
|
|
362
362
|
</code><button type="button">Copy</button></pre>
|
|
363
363
|
|
|
364
364
|
</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>
|
|
365
365
|
</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">EventTarget</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">DefaultEventMap</span><span class="tsd-signature-symbol">></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}
|
|
366
366
|
objects.</p>
|
|
367
|
-
</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"
|
|
368
|
-
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in 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="#_attachhandlers" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_attach<wbr/>Handlers</span></a><a href="#_buildargoptions" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_build<wbr/>Arg<wbr/>Options</span></a><a href="#_closedatabase" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_close<wbr/>Database</span></a><a href="#_closesocket" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_close<wbr/>Socket</span></a><a href="#_createlogger" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_create<wbr/>Logger</span></a><a href="#_getversion" class="tsd-is-protected"><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/>Version</span></a><a href="#_initdb" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_initDB</span></a><a href="#_initialize" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_initialize</span></a><a href="#_initlogger" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_init<wbr/>Logger</span></a><a href="#_onbeforereadyasync" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_on<wbr/>Before<wbr/>Ready<wbr/>Async</span></a><a href="#_onconfigload" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_on<wbr/>Config<wbr/>Load</span></a><a href="#_onready" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_on<wbr/>Ready</span></a><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="#attachhandler" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>attach<wbr/>Handler</span></a><a href="#attachhandlerinstance" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>attach<wbr/>Handler<wbr/>Instance</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="#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="#getcmdlineargs" class=""><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/>Cmd<wbr/>Line<wbr/>Args</span></a><a href="#getconfig" class=""><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/>Config</span></a><a href="#getconfigfilepath" class=""><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/>Config<wbr/>File<wbr/>Path</span></a><a href="#getconfigfromcliargs" class=""><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/>Config<wbr/>FromCLIArgs</span></a><a href="#getdb" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>getDB</span></a><a href="#getlocalconfigfilepath" class=""><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/>Local<wbr/>Config<wbr/>File<wbr/>Path</span></a><a href="#getlogger" class=""><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/>Logger</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="#getname" class=""><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/>Name</span></a><a href="#getport" class=""><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/>Port</span></a><a href="#getprogram" class=""><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/>Program</span></a><a href="#getrequestsizelimit" class=""><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/>Request<wbr/>Size<wbr/>Limit</span></a><a href="#gettokenmanager" class=""><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/>Token<wbr/>Manager</span></a><a href="#getversion" class=""><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/>Version</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="#loadconfig" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Config</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="#settokenmanager" class=""><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/>Token<wbr/>Manager</span></a><a href="#shouldlisten" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>should<wbr/>Listen</span></a><a href="#start" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</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="../index.html">@breautek/storm</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>
|
|
367
|
+
</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" id="since-27">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>
|
|
368
|
+
</div></div><aside class="tsd-sources"><p>Inherited from EventEmitter.setMaxListeners</p><ul><li>Defined in 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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-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"><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="#_attachhandlers" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>attach<wbr/>Handlers</span></a><a href="#_buildargoptions" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>build<wbr/>Arg<wbr/>Options</span></a><a href="#_closedatabase" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>close<wbr/>Database</span></a><a href="#_closesocket" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>close<wbr/>Socket</span></a><a href="#_createlogger" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>create<wbr/>Logger</span></a><a href="#_getversion" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>get<wbr/>Version</span></a><a href="#_initdb" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>init<wbr/>DB</span></a><a href="#_initialize" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>initialize</span></a><a href="#_initlogger" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>init<wbr/>Logger</span></a><a href="#_onbeforereadyasync" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Before<wbr/>Ready<wbr/>Async</span></a><a href="#_onconfigload" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Config<wbr/>Load</span></a><a href="#_onready" class="tsd-is-protected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_<wbr/>on<wbr/>Ready</span></a><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="#attachhandler"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>attach<wbr/>Handler</span></a><a href="#attachhandlerinstance"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>attach<wbr/>Handler<wbr/>Instance</span></a><a href="#close"><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="#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="#getcmdlineargs"><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/>Cmd<wbr/>Line<wbr/>Args</span></a><a href="#getconfig"><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/>Config</span></a><a href="#getconfigfilepath"><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/>Config<wbr/>File<wbr/>Path</span></a><a href="#getconfigfromcliargs"><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/>Config<wbr/>From<wbr/>CLI<wbr/>Args</span></a><a href="#getdb"><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/>DB</span></a><a href="#getlocalconfigfilepath"><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/>Local<wbr/>Config<wbr/>File<wbr/>Path</span></a><a href="#getlogger"><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/>Logger</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="#getname"><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/>Name</span></a><a href="#getport"><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/>Port</span></a><a href="#getprogram"><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/>Program</span></a><a href="#getrequestsizelimit"><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/>Request<wbr/>Size<wbr/>Limit</span></a><a href="#gettokenmanager"><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/>Token<wbr/>Manager</span></a><a href="#getversion"><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/>Version</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="#loadconfig"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Config</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="#settokenmanager"><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/>Token<wbr/>Manager</span></a><a href="#shouldlisten"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>should<wbr/>Listen</span></a><a href="#start"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</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="../index.html">@breautek/storm</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>
|