@node-red/editor-client 3.0.2 → 3.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/de/infotips.json +0 -0
  3. package/locales/de/jsonata.json +0 -0
  4. package/locales/en-US/editor.json +37 -6
  5. package/locales/en-US/infotips.json +0 -0
  6. package/locales/en-US/jsonata.json +0 -0
  7. package/locales/fr/editor.json +1238 -0
  8. package/locales/fr/infotips.json +23 -0
  9. package/locales/fr/jsonata.json +274 -0
  10. package/locales/ja/editor.json +48 -9
  11. package/locales/ko/editor.json +233 -31
  12. package/locales/ko/infotips.json +0 -0
  13. package/locales/ko/jsonata.json +0 -0
  14. package/locales/pt-BR/editor.json +1208 -0
  15. package/locales/pt-BR/infotips.json +23 -0
  16. package/locales/pt-BR/jsonata.json +274 -0
  17. package/locales/ru/editor.json +2 -0
  18. package/locales/ru/infotips.json +0 -0
  19. package/locales/ru/jsonata.json +0 -0
  20. package/locales/zh-CN/editor.json +1175 -1049
  21. package/locales/zh-TW/editor.json +3 -0
  22. package/package.json +1 -1
  23. package/public/red/about +140 -0
  24. package/public/red/red.js +2699 -1397
  25. package/public/red/red.min.js +4 -3
  26. package/public/red/style.min.css +1 -1
  27. package/public/red/tours/3.0/images/context-menu.png +0 -0
  28. package/public/red/tours/3.0/welcome.js +155 -0
  29. package/public/red/tours/images/context-menu.png +0 -0
  30. package/public/red/tours/images/global-env-vars.png +0 -0
  31. package/public/red/tours/images/hiding-flows.png +0 -0
  32. package/public/red/tours/images/locking-flows.png +0 -0
  33. package/public/red/tours/images/mermaid.png +0 -0
  34. package/public/red/tours/images/node-help.png +0 -0
  35. package/public/red/tours/images/tab-changes.png +0 -0
  36. package/public/red/tours/welcome.js +111 -94
  37. package/public/types/node/assert/strict.d.ts +11 -0
  38. package/public/types/node/assert.d.ts +898 -64
  39. package/public/types/node/async_hooks.d.ts +362 -94
  40. package/public/types/node/buffer.d.ts +2158 -14
  41. package/public/types/node/child_process.d.ts +1109 -257
  42. package/public/types/node/cluster.d.ts +349 -200
  43. package/public/types/node/console.d.ts +313 -43
  44. package/public/types/node/crypto.d.ts +3329 -656
  45. package/public/types/node/dgram.d.ts +459 -58
  46. package/public/types/node/diagnostics_channel.d.ts +155 -0
  47. package/public/types/node/dns/promises.d.ts +371 -0
  48. package/public/types/node/dns.d.ts +532 -265
  49. package/public/types/node/domain.d.ts +159 -16
  50. package/public/types/node/events.d.ts +589 -30
  51. package/public/types/node/fs/promises.d.ts +1097 -0
  52. package/public/types/node/fs.d.ts +2484 -958
  53. package/public/types/node/globals.d.ts +43 -503
  54. package/public/types/node/http.d.ts +1156 -145
  55. package/public/types/node/http2.d.ts +1610 -470
  56. package/public/types/node/https.d.ts +462 -72
  57. package/public/types/node/module.d.ts +72 -13
  58. package/public/types/node/net.d.ts +663 -131
  59. package/public/types/node/os.d.ts +238 -25
  60. package/public/types/node/path.d.ts +57 -23
  61. package/public/types/node/perf_hooks.d.ts +424 -112
  62. package/public/types/node/process.d.ts +1261 -193
  63. package/public/types/node/querystring.d.ts +107 -7
  64. package/public/types/node/readline.d.ts +443 -74
  65. package/public/types/node/stream/consumers.d.ts +15 -0
  66. package/public/types/node/stream/promises.d.ts +45 -0
  67. package/public/types/node/stream/web.d.ts +395 -0
  68. package/public/types/node/stream.d.ts +1081 -177
  69. package/public/types/node/string_decoder.d.ts +57 -0
  70. package/public/types/node/test.d.ts +193 -0
  71. package/public/types/node/timers/promises.d.ts +96 -0
  72. package/public/types/node/timers.d.ts +87 -12
  73. package/public/types/node/tls.d.ts +457 -222
  74. package/public/types/node/trace_events.d.ts +107 -10
  75. package/public/types/node/tty.d.ts +158 -23
  76. package/public/types/node/url.d.ts +734 -28
  77. package/public/types/node/util.d.ts +1542 -164
  78. package/public/types/node/v8.d.ts +261 -73
  79. package/public/types/node/vm.d.ts +384 -32
  80. package/public/types/node/wasi.d.ts +92 -23
  81. package/public/types/node/worker_threads.d.ts +531 -123
  82. package/public/types/node/zlib.d.ts +216 -63
  83. package/public/types/node-red/func.d.ts +3 -0
  84. package/public/vendor/jquery/css/base/images/ui-icons_444444_256x240.png +0 -0
  85. package/public/vendor/jquery/css/base/images/ui-icons_555555_256x240.png +0 -0
  86. package/public/vendor/jquery/css/base/images/ui-icons_777620_256x240.png +0 -0
  87. package/public/vendor/jquery/css/base/images/ui-icons_777777_256x240.png +0 -0
  88. package/public/vendor/jquery/css/base/images/ui-icons_cc0000_256x240.png +0 -0
  89. package/public/vendor/jquery/css/base/images/ui-icons_ffffff_256x240.png +0 -0
  90. package/public/vendor/jquery/css/base/jquery-ui.min.css +4 -4
  91. package/public/vendor/mermaid/mermaid.min.js +1284 -0
  92. package/public/vendor/monaco/dist/{ade705761eb7e702770d.ttf → 7064e66c3890a12c47b4.ttf} +0 -0
  93. package/public/vendor/monaco/dist/css.worker.js +1 -1
  94. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  95. package/public/vendor/monaco/dist/editor.js +1 -1
  96. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +5 -1
  97. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  98. package/public/vendor/monaco/dist/html.worker.js +1 -1
  99. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  100. package/public/vendor/monaco/dist/json.worker.js +1 -1
  101. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  102. package/public/vendor/monaco/dist/locale/cs.js +319 -71
  103. package/public/vendor/monaco/dist/locale/de.js +323 -75
  104. package/public/vendor/monaco/dist/locale/es.js +318 -70
  105. package/public/vendor/monaco/dist/locale/fr.js +327 -79
  106. package/public/vendor/monaco/dist/locale/it.js +325 -77
  107. package/public/vendor/monaco/dist/locale/ja.js +337 -89
  108. package/public/vendor/monaco/dist/locale/ko.js +324 -76
  109. package/public/vendor/monaco/dist/locale/pl.js +322 -74
  110. package/public/vendor/monaco/dist/locale/pt-br.js +321 -73
  111. package/public/vendor/monaco/dist/locale/qps-ploc.js +1580 -1332
  112. package/public/vendor/monaco/dist/locale/ru.js +324 -76
  113. package/public/vendor/monaco/dist/locale/tr.js +326 -78
  114. package/public/vendor/monaco/dist/locale/zh-hans.js +328 -80
  115. package/public/vendor/monaco/dist/locale/zh-hant.js +321 -73
  116. package/public/vendor/monaco/dist/theme/forge.json +236 -0
  117. package/public/vendor/monaco/dist/theme/github-dark.json +348 -0
  118. package/public/vendor/monaco/dist/theme/github-light.json +348 -0
  119. package/public/vendor/monaco/dist/theme/nord.json +93 -0
  120. package/public/vendor/monaco/dist/ts.worker.js +1 -1
  121. package/public/vendor/monaco/dist/ts.worker.js.LICENSE.txt +14 -6
  122. package/public/vendor/vendor.js +9 -15
  123. /package/public/red/tours/{images → 3.0/images}/continuous-search.png +0 -0
  124. /package/public/red/tours/{images → 3.0/images}/debug-path-tooltip.png +0 -0
  125. /package/public/red/tours/{images → 3.0/images}/junction-quick-add.png +0 -0
  126. /package/public/red/tours/{images → 3.0/images}/junction-slice.gif +0 -0
  127. /package/public/red/tours/{images → 3.0/images}/split-wire-with-links.gif +0 -0
@@ -1,6 +1,42 @@
1
1
 
2
2
  /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
3
3
 
4
+ /**
5
+ * Much of the Node.js core API is built around an idiomatic asynchronous
6
+ * event-driven architecture in which certain kinds of objects (called "emitters")
7
+ * emit named events that cause `Function` objects ("listeners") to be called.
8
+ *
9
+ * For instance: a `net.Server` object emits an event each time a peer
10
+ * connects to it; a `fs.ReadStream` emits an event when the file is opened;
11
+ * a `stream` emits an event whenever data is available to be read.
12
+ *
13
+ * All objects that emit events are instances of the `EventEmitter` class. These
14
+ * objects expose an `eventEmitter.on()` function that allows one or more
15
+ * functions to be attached to named events emitted by the object. Typically,
16
+ * event names are camel-cased strings but any valid JavaScript property key
17
+ * can be used.
18
+ *
19
+ * When the `EventEmitter` object emits an event, all of the functions attached
20
+ * to that specific event are called _synchronously_. Any values returned by the
21
+ * called listeners are _ignored_ and discarded.
22
+ *
23
+ * The following example shows a simple `EventEmitter` instance with a single
24
+ * listener. The `eventEmitter.on()` method is used to register listeners, while
25
+ * the `eventEmitter.emit()` method is used to trigger the event.
26
+ *
27
+ * ```js
28
+ * const EventEmitter = require('events');
29
+ *
30
+ * class MyEmitter extends EventEmitter {}
31
+ *
32
+ * const myEmitter = new MyEmitter();
33
+ * myEmitter.on('event', () => {
34
+ * console.log('an event occurred!');
35
+ * });
36
+ * myEmitter.emit('event');
37
+ * ```
38
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
39
+ */
4
40
  declare module 'events' {
5
41
  interface EventEmitterOptions {
6
42
  /**
@@ -8,26 +44,243 @@ declare module 'events' {
8
44
  */
9
45
  captureRejections?: boolean | undefined;
10
46
  }
11
-
12
47
  interface NodeEventTarget {
13
- once(event: string | symbol, listener: (...args: any[]) => void): this;
48
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
14
49
  }
15
-
16
50
  interface DOMEventTarget {
17
- addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
51
+ addEventListener(
52
+ eventName: string,
53
+ listener: (...args: any[]) => void,
54
+ opts?: {
55
+ once: boolean;
56
+ }
57
+ ): any;
58
+ }
59
+ interface StaticEventEmitterOptions {
60
+ signal?: AbortSignal | undefined;
18
61
  }
19
-
20
62
  interface EventEmitter extends NodeJS.EventEmitter {}
63
+ /**
64
+ * The `EventEmitter` class is defined and exposed by the `events` module:
65
+ *
66
+ * ```js
67
+ * const EventEmitter = require('events');
68
+ * ```
69
+ *
70
+ * All `EventEmitter`s emit the event `'newListener'` when new listeners are
71
+ * added and `'removeListener'` when existing listeners are removed.
72
+ *
73
+ * It supports the following option:
74
+ * @since v0.1.26
75
+ */
21
76
  class EventEmitter {
22
77
  constructor(options?: EventEmitterOptions);
23
-
24
- static once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
25
- static once(emitter: DOMEventTarget, event: string): Promise<any[]>;
26
- static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator<any>;
27
-
28
- /** @deprecated since v4.0.0 */
29
- static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
30
-
78
+ /**
79
+ * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
80
+ * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
81
+ * The `Promise` will resolve with an array of all the arguments emitted to the
82
+ * given event.
83
+ *
84
+ * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
85
+ * semantics and does not listen to the `'error'` event.
86
+ *
87
+ * ```js
88
+ * const { once, EventEmitter } = require('events');
89
+ *
90
+ * async function run() {
91
+ * const ee = new EventEmitter();
92
+ *
93
+ * process.nextTick(() => {
94
+ * ee.emit('myevent', 42);
95
+ * });
96
+ *
97
+ * const [value] = await once(ee, 'myevent');
98
+ * console.log(value);
99
+ *
100
+ * const err = new Error('kaboom');
101
+ * process.nextTick(() => {
102
+ * ee.emit('error', err);
103
+ * });
104
+ *
105
+ * try {
106
+ * await once(ee, 'myevent');
107
+ * } catch (err) {
108
+ * console.log('error happened', err);
109
+ * }
110
+ * }
111
+ *
112
+ * run();
113
+ * ```
114
+ *
115
+ * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
116
+ * '`error'` event itself, then it is treated as any other kind of event without
117
+ * special handling:
118
+ *
119
+ * ```js
120
+ * const { EventEmitter, once } = require('events');
121
+ *
122
+ * const ee = new EventEmitter();
123
+ *
124
+ * once(ee, 'error')
125
+ * .then(([err]) => console.log('ok', err.message))
126
+ * .catch((err) => console.log('error', err.message));
127
+ *
128
+ * ee.emit('error', new Error('boom'));
129
+ *
130
+ * // Prints: ok boom
131
+ * ```
132
+ *
133
+ * An `AbortSignal` can be used to cancel waiting for the event:
134
+ *
135
+ * ```js
136
+ * const { EventEmitter, once } = require('events');
137
+ *
138
+ * const ee = new EventEmitter();
139
+ * const ac = new AbortController();
140
+ *
141
+ * async function foo(emitter, event, signal) {
142
+ * try {
143
+ * await once(emitter, event, { signal });
144
+ * console.log('event emitted!');
145
+ * } catch (error) {
146
+ * if (error.name === 'AbortError') {
147
+ * console.error('Waiting for the event was canceled!');
148
+ * } else {
149
+ * console.error('There was an error', error.message);
150
+ * }
151
+ * }
152
+ * }
153
+ *
154
+ * foo(ee, 'foo', ac.signal);
155
+ * ac.abort(); // Abort waiting for the event
156
+ * ee.emit('foo'); // Prints: Waiting for the event was canceled!
157
+ * ```
158
+ * @since v11.13.0, v10.16.0
159
+ */
160
+ static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
161
+ static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
162
+ /**
163
+ * ```js
164
+ * const { on, EventEmitter } = require('events');
165
+ *
166
+ * (async () => {
167
+ * const ee = new EventEmitter();
168
+ *
169
+ * // Emit later on
170
+ * process.nextTick(() => {
171
+ * ee.emit('foo', 'bar');
172
+ * ee.emit('foo', 42);
173
+ * });
174
+ *
175
+ * for await (const event of on(ee, 'foo')) {
176
+ * // The execution of this inner block is synchronous and it
177
+ * // processes one event at a time (even with await). Do not use
178
+ * // if concurrent execution is required.
179
+ * console.log(event); // prints ['bar'] [42]
180
+ * }
181
+ * // Unreachable here
182
+ * })();
183
+ * ```
184
+ *
185
+ * Returns an `AsyncIterator` that iterates `eventName` events. It will throw
186
+ * if the `EventEmitter` emits `'error'`. It removes all listeners when
187
+ * exiting the loop. The `value` returned by each iteration is an array
188
+ * composed of the emitted event arguments.
189
+ *
190
+ * An `AbortSignal` can be used to cancel waiting on events:
191
+ *
192
+ * ```js
193
+ * const { on, EventEmitter } = require('events');
194
+ * const ac = new AbortController();
195
+ *
196
+ * (async () => {
197
+ * const ee = new EventEmitter();
198
+ *
199
+ * // Emit later on
200
+ * process.nextTick(() => {
201
+ * ee.emit('foo', 'bar');
202
+ * ee.emit('foo', 42);
203
+ * });
204
+ *
205
+ * for await (const event of on(ee, 'foo', { signal: ac.signal })) {
206
+ * // The execution of this inner block is synchronous and it
207
+ * // processes one event at a time (even with await). Do not use
208
+ * // if concurrent execution is required.
209
+ * console.log(event); // prints ['bar'] [42]
210
+ * }
211
+ * // Unreachable here
212
+ * })();
213
+ *
214
+ * process.nextTick(() => ac.abort());
215
+ * ```
216
+ * @since v13.6.0, v12.16.0
217
+ * @param eventName The name of the event being listened for
218
+ * @return that iterates `eventName` events emitted by the `emitter`
219
+ */
220
+ static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
221
+ /**
222
+ * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
223
+ *
224
+ * ```js
225
+ * const { EventEmitter, listenerCount } = require('events');
226
+ * const myEmitter = new EventEmitter();
227
+ * myEmitter.on('event', () => {});
228
+ * myEmitter.on('event', () => {});
229
+ * console.log(listenerCount(myEmitter, 'event'));
230
+ * // Prints: 2
231
+ * ```
232
+ * @since v0.9.12
233
+ * @deprecated Since v3.2.0 - Use `listenerCount` instead.
234
+ * @param emitter The emitter to query
235
+ * @param eventName The event name
236
+ */
237
+ static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
238
+ /**
239
+ * Returns a copy of the array of listeners for the event named `eventName`.
240
+ *
241
+ * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
242
+ * the emitter.
243
+ *
244
+ * For `EventTarget`s this is the only way to get the event listeners for the
245
+ * event target. This is useful for debugging and diagnostic purposes.
246
+ *
247
+ * ```js
248
+ * const { getEventListeners, EventEmitter } = require('events');
249
+ *
250
+ * {
251
+ * const ee = new EventEmitter();
252
+ * const listener = () => console.log('Events are fun');
253
+ * ee.on('foo', listener);
254
+ * getEventListeners(ee, 'foo'); // [listener]
255
+ * }
256
+ * {
257
+ * const et = new EventTarget();
258
+ * const listener = () => console.log('Events are fun');
259
+ * et.addEventListener('foo', listener);
260
+ * getEventListeners(et, 'foo'); // [listener]
261
+ * }
262
+ * ```
263
+ * @since v15.2.0
264
+ */
265
+ static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
266
+ /**
267
+ * ```js
268
+ * const {
269
+ * setMaxListeners,
270
+ * EventEmitter
271
+ * } = require('events');
272
+ *
273
+ * const target = new EventTarget();
274
+ * const emitter = new EventEmitter();
275
+ *
276
+ * setMaxListeners(5, target, emitter);
277
+ * ```
278
+ * @since v15.4.0
279
+ * @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
280
+ * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
281
+ * objects.
282
+ */
283
+ static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
31
284
  /**
32
285
  * This symbol shall be used to install a listener for only monitoring `'error'`
33
286
  * events. Listeners installed using this symbol are called before the regular
@@ -39,7 +292,6 @@ declare module 'events' {
39
292
  */
40
293
  static readonly errorMonitor: unique symbol;
41
294
  static readonly captureRejectionSymbol: unique symbol;
42
-
43
295
  /**
44
296
  * Sets or gets the default captureRejection value for all emitters.
45
297
  */
@@ -47,36 +299,343 @@ declare module 'events' {
47
299
  static captureRejections: boolean;
48
300
  static defaultMaxListeners: number;
49
301
  }
50
-
51
- import internal = require('events');
302
+ import internal = require('node:events');
52
303
  namespace EventEmitter {
53
304
  // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
54
305
  export { internal as EventEmitter };
306
+ export interface Abortable {
307
+ /**
308
+ * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
309
+ */
310
+ signal?: AbortSignal | undefined;
311
+ }
55
312
  }
56
-
57
313
  global {
58
314
  namespace NodeJS {
59
315
  interface EventEmitter {
60
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
61
- on(event: string | symbol, listener: (...args: any[]) => void): this;
62
- once(event: string | symbol, listener: (...args: any[]) => void): this;
63
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
64
- off(event: string | symbol, listener: (...args: any[]) => void): this;
316
+ /**
317
+ * Alias for `emitter.on(eventName, listener)`.
318
+ * @since v0.1.26
319
+ */
320
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
321
+ /**
322
+ * Adds the `listener` function to the end of the listeners array for the
323
+ * event named `eventName`. No checks are made to see if the `listener` has
324
+ * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
325
+ * times.
326
+ *
327
+ * ```js
328
+ * server.on('connection', (stream) => {
329
+ * console.log('someone connected!');
330
+ * });
331
+ * ```
332
+ *
333
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
334
+ *
335
+ * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
336
+ * event listener to the beginning of the listeners array.
337
+ *
338
+ * ```js
339
+ * const myEE = new EventEmitter();
340
+ * myEE.on('foo', () => console.log('a'));
341
+ * myEE.prependListener('foo', () => console.log('b'));
342
+ * myEE.emit('foo');
343
+ * // Prints:
344
+ * // b
345
+ * // a
346
+ * ```
347
+ * @since v0.1.101
348
+ * @param eventName The name of the event.
349
+ * @param listener The callback function
350
+ */
351
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
352
+ /**
353
+ * Adds a **one-time**`listener` function for the event named `eventName`. The
354
+ * next time `eventName` is triggered, this listener is removed and then invoked.
355
+ *
356
+ * ```js
357
+ * server.once('connection', (stream) => {
358
+ * console.log('Ah, we have our first user!');
359
+ * });
360
+ * ```
361
+ *
362
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
363
+ *
364
+ * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
365
+ * event listener to the beginning of the listeners array.
366
+ *
367
+ * ```js
368
+ * const myEE = new EventEmitter();
369
+ * myEE.once('foo', () => console.log('a'));
370
+ * myEE.prependOnceListener('foo', () => console.log('b'));
371
+ * myEE.emit('foo');
372
+ * // Prints:
373
+ * // b
374
+ * // a
375
+ * ```
376
+ * @since v0.3.0
377
+ * @param eventName The name of the event.
378
+ * @param listener The callback function
379
+ */
380
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
381
+ /**
382
+ * Removes the specified `listener` from the listener array for the event named`eventName`.
383
+ *
384
+ * ```js
385
+ * const callback = (stream) => {
386
+ * console.log('someone connected!');
387
+ * };
388
+ * server.on('connection', callback);
389
+ * // ...
390
+ * server.removeListener('connection', callback);
391
+ * ```
392
+ *
393
+ * `removeListener()` will remove, at most, one instance of a listener from the
394
+ * listener array. If any single listener has been added multiple times to the
395
+ * listener array for the specified `eventName`, then `removeListener()` must be
396
+ * called multiple times to remove each instance.
397
+ *
398
+ * Once an event is emitted, all listeners attached to it at the
399
+ * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will
400
+ * not remove them from`emit()` in progress. Subsequent events behave as expected.
401
+ *
402
+ * ```js
403
+ * const myEmitter = new MyEmitter();
404
+ *
405
+ * const callbackA = () => {
406
+ * console.log('A');
407
+ * myEmitter.removeListener('event', callbackB);
408
+ * };
409
+ *
410
+ * const callbackB = () => {
411
+ * console.log('B');
412
+ * };
413
+ *
414
+ * myEmitter.on('event', callbackA);
415
+ *
416
+ * myEmitter.on('event', callbackB);
417
+ *
418
+ * // callbackA removes listener callbackB but it will still be called.
419
+ * // Internal listener array at time of emit [callbackA, callbackB]
420
+ * myEmitter.emit('event');
421
+ * // Prints:
422
+ * // A
423
+ * // B
424
+ *
425
+ * // callbackB is now removed.
426
+ * // Internal listener array [callbackA]
427
+ * myEmitter.emit('event');
428
+ * // Prints:
429
+ * // A
430
+ * ```
431
+ *
432
+ * Because listeners are managed using an internal array, calling this will
433
+ * change the position indices of any listener registered _after_ the listener
434
+ * being removed. This will not impact the order in which listeners are called,
435
+ * but it means that any copies of the listener array as returned by
436
+ * the `emitter.listeners()` method will need to be recreated.
437
+ *
438
+ * When a single function has been added as a handler multiple times for a single
439
+ * event (as in the example below), `removeListener()` will remove the most
440
+ * recently added instance. In the example the `once('ping')`listener is removed:
441
+ *
442
+ * ```js
443
+ * const ee = new EventEmitter();
444
+ *
445
+ * function pong() {
446
+ * console.log('pong');
447
+ * }
448
+ *
449
+ * ee.on('ping', pong);
450
+ * ee.once('ping', pong);
451
+ * ee.removeListener('ping', pong);
452
+ *
453
+ * ee.emit('ping');
454
+ * ee.emit('ping');
455
+ * ```
456
+ *
457
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
458
+ * @since v0.1.26
459
+ */
460
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
461
+ /**
462
+ * Alias for `emitter.removeListener()`.
463
+ * @since v10.0.0
464
+ */
465
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
466
+ /**
467
+ * Removes all listeners, or those of the specified `eventName`.
468
+ *
469
+ * It is bad practice to remove listeners added elsewhere in the code,
470
+ * particularly when the `EventEmitter` instance was created by some other
471
+ * component or module (e.g. sockets or file streams).
472
+ *
473
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
474
+ * @since v0.1.26
475
+ */
65
476
  removeAllListeners(event?: string | symbol): this;
477
+ /**
478
+ * By default `EventEmitter`s will print a warning if more than `10` listeners are
479
+ * added for a particular event. This is a useful default that helps finding
480
+ * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
481
+ * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
482
+ *
483
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
484
+ * @since v0.3.5
485
+ */
66
486
  setMaxListeners(n: number): this;
487
+ /**
488
+ * Returns the current max listener value for the `EventEmitter` which is either
489
+ * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
490
+ * @since v1.0.0
491
+ */
67
492
  getMaxListeners(): number;
68
- listeners(event: string | symbol): Function[];
69
- rawListeners(event: string | symbol): Function[];
70
- emit(event: string | symbol, ...args: any[]): boolean;
71
- listenerCount(event: string | symbol): number;
72
- // Added in Node 6...
73
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
74
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
493
+ /**
494
+ * Returns a copy of the array of listeners for the event named `eventName`.
495
+ *
496
+ * ```js
497
+ * server.on('connection', (stream) => {
498
+ * console.log('someone connected!');
499
+ * });
500
+ * console.log(util.inspect(server.listeners('connection')));
501
+ * // Prints: [ [Function] ]
502
+ * ```
503
+ * @since v0.1.26
504
+ */
505
+ listeners(eventName: string | symbol): Function[];
506
+ /**
507
+ * Returns a copy of the array of listeners for the event named `eventName`,
508
+ * including any wrappers (such as those created by `.once()`).
509
+ *
510
+ * ```js
511
+ * const emitter = new EventEmitter();
512
+ * emitter.once('log', () => console.log('log once'));
513
+ *
514
+ * // Returns a new Array with a function `onceWrapper` which has a property
515
+ * // `listener` which contains the original listener bound above
516
+ * const listeners = emitter.rawListeners('log');
517
+ * const logFnWrapper = listeners[0];
518
+ *
519
+ * // Logs "log once" to the console and does not unbind the `once` event
520
+ * logFnWrapper.listener();
521
+ *
522
+ * // Logs "log once" to the console and removes the listener
523
+ * logFnWrapper();
524
+ *
525
+ * emitter.on('log', () => console.log('log persistently'));
526
+ * // Will return a new Array with a single function bound by `.on()` above
527
+ * const newListeners = emitter.rawListeners('log');
528
+ *
529
+ * // Logs "log persistently" twice
530
+ * newListeners[0]();
531
+ * emitter.emit('log');
532
+ * ```
533
+ * @since v9.4.0
534
+ */
535
+ rawListeners(eventName: string | symbol): Function[];
536
+ /**
537
+ * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
538
+ * to each.
539
+ *
540
+ * Returns `true` if the event had listeners, `false` otherwise.
541
+ *
542
+ * ```js
543
+ * const EventEmitter = require('events');
544
+ * const myEmitter = new EventEmitter();
545
+ *
546
+ * // First listener
547
+ * myEmitter.on('event', function firstListener() {
548
+ * console.log('Helloooo! first listener');
549
+ * });
550
+ * // Second listener
551
+ * myEmitter.on('event', function secondListener(arg1, arg2) {
552
+ * console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
553
+ * });
554
+ * // Third listener
555
+ * myEmitter.on('event', function thirdListener(...args) {
556
+ * const parameters = args.join(', ');
557
+ * console.log(`event with parameters ${parameters} in third listener`);
558
+ * });
559
+ *
560
+ * console.log(myEmitter.listeners('event'));
561
+ *
562
+ * myEmitter.emit('event', 1, 2, 3, 4, 5);
563
+ *
564
+ * // Prints:
565
+ * // [
566
+ * // [Function: firstListener],
567
+ * // [Function: secondListener],
568
+ * // [Function: thirdListener]
569
+ * // ]
570
+ * // Helloooo! first listener
571
+ * // event with parameters 1, 2 in second listener
572
+ * // event with parameters 1, 2, 3, 4, 5 in third listener
573
+ * ```
574
+ * @since v0.1.26
575
+ */
576
+ emit(eventName: string | symbol, ...args: any[]): boolean;
577
+ /**
578
+ * Returns the number of listeners listening to the event named `eventName`.
579
+ * @since v3.2.0
580
+ * @param eventName The name of the event being listened for
581
+ */
582
+ listenerCount(eventName: string | symbol): number;
583
+ /**
584
+ * Adds the `listener` function to the _beginning_ of the listeners array for the
585
+ * event named `eventName`. No checks are made to see if the `listener` has
586
+ * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
587
+ * times.
588
+ *
589
+ * ```js
590
+ * server.prependListener('connection', (stream) => {
591
+ * console.log('someone connected!');
592
+ * });
593
+ * ```
594
+ *
595
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
596
+ * @since v6.0.0
597
+ * @param eventName The name of the event.
598
+ * @param listener The callback function
599
+ */
600
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
601
+ /**
602
+ * Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this
603
+ * listener is removed, and then invoked.
604
+ *
605
+ * ```js
606
+ * server.prependOnceListener('connection', (stream) => {
607
+ * console.log('Ah, we have our first user!');
608
+ * });
609
+ * ```
610
+ *
611
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
612
+ * @since v6.0.0
613
+ * @param eventName The name of the event.
614
+ * @param listener The callback function
615
+ */
616
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
617
+ /**
618
+ * Returns an array listing the events for which the emitter has registered
619
+ * listeners. The values in the array are strings or `Symbol`s.
620
+ *
621
+ * ```js
622
+ * const EventEmitter = require('events');
623
+ * const myEE = new EventEmitter();
624
+ * myEE.on('foo', () => {});
625
+ * myEE.on('bar', () => {});
626
+ *
627
+ * const sym = Symbol('symbol');
628
+ * myEE.on(sym, () => {});
629
+ *
630
+ * console.log(myEE.eventNames());
631
+ * // Prints: [ 'foo', 'bar', Symbol(symbol) ]
632
+ * ```
633
+ * @since v6.0.0
634
+ */
75
635
  eventNames(): Array<string | symbol>;
76
636
  }
77
637
  }
78
638
  }
79
-
80
639
  export = EventEmitter;
81
640
  }
82
641
  declare module 'node:events' {