dualsense-ts 2.0.2 → 2.0.3

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.
@@ -0,0 +1,1549 @@
1
+ # Class: Momentary
2
+
3
+ ## Hierarchy
4
+
5
+ - [`Input`](../wiki/Input)<`boolean`\>
6
+
7
+ ↳ **`Momentary`**
8
+
9
+ ↳↳ [`Mute`](../wiki/Mute)
10
+
11
+ ## Table of contents
12
+
13
+ ### Constructors
14
+
15
+ - [constructor](../wiki/Momentary#constructor)
16
+
17
+ ### Properties
18
+
19
+ - [[InputChanged]](../wiki/Momentary#%5Binputchanged%5D)
20
+ - [[InputChildless]](../wiki/Momentary#%5Binputchildless%5D)
21
+ - [[InputIcon]](../wiki/Momentary#%5Binputicon%5D)
22
+ - [[InputName]](../wiki/Momentary#%5Binputname%5D)
23
+ - [[InputParent]](../wiki/Momentary#%5Binputparent%5D)
24
+ - [id](../wiki/Momentary#id)
25
+ - [lastChange](../wiki/Momentary#lastchange)
26
+ - [lastInput](../wiki/Momentary#lastinput)
27
+ - [state](../wiki/Momentary#state)
28
+ - [threshold](../wiki/Momentary#threshold)
29
+ - [captureRejectionSymbol](../wiki/Momentary#capturerejectionsymbol)
30
+ - [captureRejections](../wiki/Momentary#capturerejections)
31
+ - [defaultMaxListeners](../wiki/Momentary#defaultmaxlisteners)
32
+ - [errorMonitor](../wiki/Momentary#errormonitor)
33
+
34
+ ### Accessors
35
+
36
+ - [[toStringTag]](../wiki/Momentary#%5Btostringtag%5D)
37
+ - [active](../wiki/Momentary#active)
38
+
39
+ ### Methods
40
+
41
+ - [[InputAdopt]](../wiki/Momentary#%5Binputadopt%5D)
42
+ - [[InputChangedPrimitive]](../wiki/Momentary#%5Binputchangedprimitive%5D)
43
+ - [[InputChangedThreshold]](../wiki/Momentary#%5Binputchangedthreshold%5D)
44
+ - [[InputChangedVirtual]](../wiki/Momentary#%5Binputchangedvirtual%5D)
45
+ - [[InputSetComparison]](../wiki/Momentary#%5Binputsetcomparison%5D)
46
+ - [[InputSet]](../wiki/Momentary#%5Binputset%5D)
47
+ - [[asyncIterator]](../wiki/Momentary#%5Basynciterator%5D)
48
+ - [[custom]](../wiki/Momentary#%5Bcustom%5D)
49
+ - [[toPrimitive]](../wiki/Momentary#%5Btoprimitive%5D)
50
+ - [addListener](../wiki/Momentary#addlistener)
51
+ - [emit](../wiki/Momentary#emit)
52
+ - [eventNames](../wiki/Momentary#eventnames)
53
+ - [getMaxListeners](../wiki/Momentary#getmaxlisteners)
54
+ - [listenerCount](../wiki/Momentary#listenercount)
55
+ - [listeners](../wiki/Momentary#listeners)
56
+ - [next](../wiki/Momentary#next)
57
+ - [off](../wiki/Momentary#off)
58
+ - [on](../wiki/Momentary#on)
59
+ - [once](../wiki/Momentary#once)
60
+ - [prependListener](../wiki/Momentary#prependlistener)
61
+ - [prependOnceListener](../wiki/Momentary#prependoncelistener)
62
+ - [promise](../wiki/Momentary#promise)
63
+ - [rawListeners](../wiki/Momentary#rawlisteners)
64
+ - [removeAllListeners](../wiki/Momentary#removealllisteners)
65
+ - [removeListener](../wiki/Momentary#removelistener)
66
+ - [setMaxListeners](../wiki/Momentary#setmaxlisteners)
67
+ - [toString](../wiki/Momentary#tostring)
68
+ - [getEventListeners](../wiki/Momentary#geteventlisteners)
69
+ - [listenerCount](../wiki/Momentary#listenercount-1)
70
+ - [on](../wiki/Momentary#on-1)
71
+ - [once](../wiki/Momentary#once-1)
72
+ - [setMaxListeners](../wiki/Momentary#setmaxlisteners-1)
73
+
74
+ ## Constructors
75
+
76
+ ### constructor
77
+
78
+ • **new Momentary**(`params?`)
79
+
80
+ #### Parameters
81
+
82
+ | Name | Type |
83
+ | :------ | :------ |
84
+ | `params?` | [`InputParams`](../wiki/InputParams) |
85
+
86
+ #### Inherited from
87
+
88
+ [Input](../wiki/Input).[constructor](../wiki/Input#constructor)
89
+
90
+ #### Defined in
91
+
92
+ [src/input.ts:102](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L102)
93
+
94
+ ## Properties
95
+
96
+ ### [InputChanged]
97
+
98
+ • **[InputChanged]**: (`state`: `boolean`, `newState`: `boolean`) => `boolean`
99
+
100
+ #### Type declaration
101
+
102
+ ▸ (`state`, `newState`): `boolean`
103
+
104
+ ##### Parameters
105
+
106
+ | Name | Type |
107
+ | :------ | :------ |
108
+ | `state` | `boolean` |
109
+ | `newState` | `boolean` |
110
+
111
+ ##### Returns
112
+
113
+ `boolean`
114
+
115
+ #### Inherited from
116
+
117
+ [Input](../wiki/Input).[[InputChanged]](../wiki/Input#%5Binputchanged%5D)
118
+
119
+ #### Defined in
120
+
121
+ [src/input.ts:124](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L124)
122
+
123
+ ___
124
+
125
+ ### [InputChildless]
126
+
127
+ • **[InputChildless]**: `boolean` = `true`
128
+
129
+ #### Inherited from
130
+
131
+ [Input](../wiki/Input).[[InputChildless]](../wiki/Input#%5Binputchildless%5D)
132
+
133
+ #### Defined in
134
+
135
+ [src/input.ts:158](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L158)
136
+
137
+ ___
138
+
139
+ ### [InputIcon]
140
+
141
+ • `Readonly` **[InputIcon]**: `string`
142
+
143
+ #### Inherited from
144
+
145
+ [Input](../wiki/Input).[[InputIcon]](../wiki/Input#%5Binputicon%5D)
146
+
147
+ #### Defined in
148
+
149
+ [src/input.ts:153](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L153)
150
+
151
+ ___
152
+
153
+ ### [InputName]
154
+
155
+ • `Readonly` **[InputName]**: `string`
156
+
157
+ #### Inherited from
158
+
159
+ [Input](../wiki/Input).[[InputName]](../wiki/Input#%5Binputname%5D)
160
+
161
+ #### Defined in
162
+
163
+ [src/input.ts:150](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L150)
164
+
165
+ ___
166
+
167
+ ### [InputParent]
168
+
169
+ • `Optional` **[InputParent]**: [`Input`](../wiki/Input)<`unknown`\>
170
+
171
+ #### Inherited from
172
+
173
+ [Input](../wiki/Input).[[InputParent]](../wiki/Input#%5Binputparent%5D)
174
+
175
+ #### Defined in
176
+
177
+ [src/input.ts:156](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L156)
178
+
179
+ ___
180
+
181
+ ### id
182
+
183
+ • `Readonly` **id**: `symbol`
184
+
185
+ #### Inherited from
186
+
187
+ [Input](../wiki/Input).[id](../wiki/Input#id)
188
+
189
+ #### Defined in
190
+
191
+ [src/input.ts:58](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L58)
192
+
193
+ ___
194
+
195
+ ### lastChange
196
+
197
+ • **lastChange**: `number`
198
+
199
+ #### Inherited from
200
+
201
+ [Input](../wiki/Input).[lastChange](../wiki/Input#lastchange)
202
+
203
+ #### Defined in
204
+
205
+ [src/input.ts:61](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L61)
206
+
207
+ ___
208
+
209
+ ### lastInput
210
+
211
+ • **lastInput**: `number`
212
+
213
+ #### Inherited from
214
+
215
+ [Input](../wiki/Input).[lastInput](../wiki/Input#lastinput)
216
+
217
+ #### Defined in
218
+
219
+ [src/input.ts:64](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L64)
220
+
221
+ ___
222
+
223
+ ### state
224
+
225
+ • **state**: `boolean` = `false`
226
+
227
+ #### Overrides
228
+
229
+ [Input](../wiki/Input).[state](../wiki/Input#state)
230
+
231
+ #### Defined in
232
+
233
+ [src/elements/momentary.ts:4](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/elements/momentary.ts#L4)
234
+
235
+ ___
236
+
237
+ ### threshold
238
+
239
+ • **threshold**: `number` = `0`
240
+
241
+ #### Inherited from
242
+
243
+ [Input](../wiki/Input).[threshold](../wiki/Input#threshold)
244
+
245
+ #### Defined in
246
+
247
+ [src/input.ts:67](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L67)
248
+
249
+ ___
250
+
251
+ ### captureRejectionSymbol
252
+
253
+ ▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](../wiki/Dualsense#capturerejectionsymbol)
254
+
255
+ #### Inherited from
256
+
257
+ [Input](../wiki/Input).[captureRejectionSymbol](../wiki/Input#capturerejectionsymbol)
258
+
259
+ #### Defined in
260
+
261
+ node_modules/@types/node/events.d.ts:301
262
+
263
+ ___
264
+
265
+ ### captureRejections
266
+
267
+ ▪ `Static` **captureRejections**: `boolean`
268
+
269
+ Sets or gets the default captureRejection value for all emitters.
270
+
271
+ #### Inherited from
272
+
273
+ [Input](../wiki/Input).[captureRejections](../wiki/Input#capturerejections)
274
+
275
+ #### Defined in
276
+
277
+ node_modules/@types/node/events.d.ts:306
278
+
279
+ ___
280
+
281
+ ### defaultMaxListeners
282
+
283
+ ▪ `Static` **defaultMaxListeners**: `number`
284
+
285
+ #### Inherited from
286
+
287
+ [Input](../wiki/Input).[defaultMaxListeners](../wiki/Input#defaultmaxlisteners)
288
+
289
+ #### Defined in
290
+
291
+ node_modules/@types/node/events.d.ts:307
292
+
293
+ ___
294
+
295
+ ### errorMonitor
296
+
297
+ ▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](../wiki/Dualsense#errormonitor)
298
+
299
+ This symbol shall be used to install a listener for only monitoring `'error'`
300
+ events. Listeners installed using this symbol are called before the regular
301
+ `'error'` listeners are called.
302
+
303
+ Installing a listener using this symbol does not change the behavior once an
304
+ `'error'` event is emitted, therefore the process will still crash if no
305
+ regular `'error'` listener is installed.
306
+
307
+ #### Inherited from
308
+
309
+ [Input](../wiki/Input).[errorMonitor](../wiki/Input#errormonitor)
310
+
311
+ #### Defined in
312
+
313
+ node_modules/@types/node/events.d.ts:300
314
+
315
+ ## Accessors
316
+
317
+ ### [toStringTag]
318
+
319
+ • `get` **[toStringTag]**(): `string`
320
+
321
+ #### Returns
322
+
323
+ `string`
324
+
325
+ #### Inherited from
326
+
327
+ Input.\_\_@toStringTag@66
328
+
329
+ #### Defined in
330
+
331
+ [src/input.ts:145](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L145)
332
+
333
+ ___
334
+
335
+ ### active
336
+
337
+ • `get` **active**(): `boolean`
338
+
339
+ #### Returns
340
+
341
+ `boolean`
342
+
343
+ #### Overrides
344
+
345
+ Input.active
346
+
347
+ #### Defined in
348
+
349
+ [src/elements/momentary.ts:6](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/elements/momentary.ts#L6)
350
+
351
+ ## Methods
352
+
353
+ ### [InputAdopt]
354
+
355
+ ▸ **[InputAdopt]**(): `void`
356
+
357
+ Cascade events from nested Inputs.
358
+ And decide if this is the root Input.
359
+
360
+ #### Returns
361
+
362
+ `void`
363
+
364
+ #### Inherited from
365
+
366
+ [Input](../wiki/Input).[[InputAdopt]](../wiki/Input#%5Binputadopt%5D)
367
+
368
+ #### Defined in
369
+
370
+ [src/input.ts:164](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L164)
371
+
372
+ ___
373
+
374
+ ### [InputChangedPrimitive]
375
+
376
+ ▸ **[InputChangedPrimitive]**(`state`, `newState`): `boolean`
377
+
378
+ #### Parameters
379
+
380
+ | Name | Type |
381
+ | :------ | :------ |
382
+ | `state` | `boolean` |
383
+ | `newState` | `boolean` |
384
+
385
+ #### Returns
386
+
387
+ `boolean`
388
+
389
+ #### Inherited from
390
+
391
+ [Input](../wiki/Input).[[InputChangedPrimitive]](../wiki/Input#%5Binputchangedprimitive%5D)
392
+
393
+ #### Defined in
394
+
395
+ [src/input.ts:186](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L186)
396
+
397
+ ___
398
+
399
+ ### [InputChangedThreshold]
400
+
401
+ ▸ **[InputChangedThreshold]**(`state`, `newState`): `boolean`
402
+
403
+ #### Parameters
404
+
405
+ | Name | Type |
406
+ | :------ | :------ |
407
+ | `state` | `number` |
408
+ | `newState` | `number` |
409
+
410
+ #### Returns
411
+
412
+ `boolean`
413
+
414
+ #### Inherited from
415
+
416
+ [Input](../wiki/Input).[[InputChangedThreshold]](../wiki/Input#%5Binputchangedthreshold%5D)
417
+
418
+ #### Defined in
419
+
420
+ [src/input.ts:190](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L190)
421
+
422
+ ___
423
+
424
+ ### [InputChangedVirtual]
425
+
426
+ ▸ **[InputChangedVirtual]**(): `boolean`
427
+
428
+ #### Returns
429
+
430
+ `boolean`
431
+
432
+ #### Inherited from
433
+
434
+ [Input](../wiki/Input).[[InputChangedVirtual]](../wiki/Input#%5Binputchangedvirtual%5D)
435
+
436
+ #### Defined in
437
+
438
+ [src/input.ts:182](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L182)
439
+
440
+ ___
441
+
442
+ ### [InputSetComparison]
443
+
444
+ ▸ **[InputSetComparison]**(): (`state`: `boolean`, `newState`: `boolean`) => `boolean`
445
+
446
+ #### Returns
447
+
448
+ `fn`
449
+
450
+ ▸ (`state`, `newState`): `boolean`
451
+
452
+ ##### Parameters
453
+
454
+ | Name | Type |
455
+ | :------ | :------ |
456
+ | `state` | `boolean` |
457
+ | `newState` | `boolean` |
458
+
459
+ ##### Returns
460
+
461
+ `boolean`
462
+
463
+ #### Inherited from
464
+
465
+ [Input](../wiki/Input).[[InputSetComparison]](../wiki/Input#%5Binputsetcomparison%5D)
466
+
467
+ #### Defined in
468
+
469
+ [src/input.ts:195](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L195)
470
+
471
+ ___
472
+
473
+ ### [InputSet]
474
+
475
+ ▸ **[InputSet]**(`state`): `void`
476
+
477
+ Update the input's state and trigger all necessary callbacks.
478
+
479
+ #### Parameters
480
+
481
+ | Name | Type |
482
+ | :------ | :------ |
483
+ | `state` | `boolean` |
484
+
485
+ #### Returns
486
+
487
+ `void`
488
+
489
+ #### Inherited from
490
+
491
+ [Input](../wiki/Input).[[InputSet]](../wiki/Input#%5Binputset%5D)
492
+
493
+ #### Defined in
494
+
495
+ [src/input.ts:211](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L211)
496
+
497
+ ___
498
+
499
+ ### [asyncIterator]
500
+
501
+ ▸ **[asyncIterator]**(): `AsyncIterator`<[`Momentary`](../wiki/Momentary), `any`, `undefined`\>
502
+
503
+ #### Returns
504
+
505
+ `AsyncIterator`<[`Momentary`](../wiki/Momentary), `any`, `undefined`\>
506
+
507
+ #### Inherited from
508
+
509
+ [Input](../wiki/Input).[[asyncIterator]](../wiki/Input#%5Basynciterator%5D)
510
+
511
+ #### Defined in
512
+
513
+ [src/input.ts:135](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L135)
514
+
515
+ ___
516
+
517
+ ### [custom]
518
+
519
+ ▸ **[custom]**(): `string`
520
+
521
+ #### Returns
522
+
523
+ `string`
524
+
525
+ #### Inherited from
526
+
527
+ [Input](../wiki/Input).[[custom]](../wiki/Input#%5Bcustom%5D)
528
+
529
+ #### Defined in
530
+
531
+ [src/input.ts:127](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L127)
532
+
533
+ ___
534
+
535
+ ### [toPrimitive]
536
+
537
+ ▸ **[toPrimitive]**(`hint`): `string` \| `number`
538
+
539
+ #### Parameters
540
+
541
+ | Name | Type |
542
+ | :------ | :------ |
543
+ | `hint` | ``"string"`` \| ``"number"`` \| ``"default"`` |
544
+
545
+ #### Returns
546
+
547
+ `string` \| `number`
548
+
549
+ #### Inherited from
550
+
551
+ [Input](../wiki/Input).[[toPrimitive]](../wiki/Input#%5Btoprimitive%5D)
552
+
553
+ #### Defined in
554
+
555
+ [src/input.ts:139](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L139)
556
+
557
+ ___
558
+
559
+ ### addListener
560
+
561
+ ▸ **addListener**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
562
+
563
+ Alias for `emitter.on(eventName, listener)`.
564
+
565
+ **`since`** v0.1.26
566
+
567
+ #### Parameters
568
+
569
+ | Name | Type |
570
+ | :------ | :------ |
571
+ | `eventName` | `string` \| `symbol` |
572
+ | `listener` | (...`args`: `any`[]) => `void` |
573
+
574
+ #### Returns
575
+
576
+ [`Momentary`](../wiki/Momentary)
577
+
578
+ #### Inherited from
579
+
580
+ [Input](../wiki/Input).[addListener](../wiki/Input#addlistener)
581
+
582
+ #### Defined in
583
+
584
+ node_modules/@types/node/events.d.ts:327
585
+
586
+ ___
587
+
588
+ ### emit
589
+
590
+ ▸ **emit**(`event`, ...`args`): `boolean`
591
+
592
+ #### Parameters
593
+
594
+ | Name | Type |
595
+ | :------ | :------ |
596
+ | `event` | [`InputEvent`](../wiki/Exports#inputevent) |
597
+ | `...args` | [[`Input`](../wiki/Input)<`boolean`\>, [`Input`](../wiki/Input)<`unknown`\> \| [`Input`](../wiki/Input)<`boolean`\>] |
598
+
599
+ #### Returns
600
+
601
+ `boolean`
602
+
603
+ #### Inherited from
604
+
605
+ [Input](../wiki/Input).[emit](../wiki/Input#emit)
606
+
607
+ #### Defined in
608
+
609
+ [src/input.ts:44](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L44)
610
+
611
+ ___
612
+
613
+ ### eventNames
614
+
615
+ ▸ **eventNames**(): (`string` \| `symbol`)[]
616
+
617
+ Returns an array listing the events for which the emitter has registered
618
+ listeners. The values in the array are strings or `Symbol`s.
619
+
620
+ ```js
621
+ const EventEmitter = require('events');
622
+ const myEE = new EventEmitter();
623
+ myEE.on('foo', () => {});
624
+ myEE.on('bar', () => {});
625
+
626
+ const sym = Symbol('symbol');
627
+ myEE.on(sym, () => {});
628
+
629
+ console.log(myEE.eventNames());
630
+ // Prints: [ 'foo', 'bar', Symbol(symbol) ]
631
+ ```
632
+
633
+ **`since`** v6.0.0
634
+
635
+ #### Returns
636
+
637
+ (`string` \| `symbol`)[]
638
+
639
+ #### Inherited from
640
+
641
+ [Input](../wiki/Input).[eventNames](../wiki/Input#eventnames)
642
+
643
+ #### Defined in
644
+
645
+ node_modules/@types/node/events.d.ts:642
646
+
647
+ ___
648
+
649
+ ### getMaxListeners
650
+
651
+ ▸ **getMaxListeners**(): `number`
652
+
653
+ Returns the current max listener value for the `EventEmitter` which is either
654
+ set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](../wiki/Momentary#defaultmaxlisteners).
655
+
656
+ **`since`** v1.0.0
657
+
658
+ #### Returns
659
+
660
+ `number`
661
+
662
+ #### Inherited from
663
+
664
+ [Input](../wiki/Input).[getMaxListeners](../wiki/Input#getmaxlisteners)
665
+
666
+ #### Defined in
667
+
668
+ node_modules/@types/node/events.d.ts:499
669
+
670
+ ___
671
+
672
+ ### listenerCount
673
+
674
+ ▸ **listenerCount**(`eventName`): `number`
675
+
676
+ Returns the number of listeners listening to the event named `eventName`.
677
+
678
+ **`since`** v3.2.0
679
+
680
+ #### Parameters
681
+
682
+ | Name | Type | Description |
683
+ | :------ | :------ | :------ |
684
+ | `eventName` | `string` \| `symbol` | The name of the event being listened for |
685
+
686
+ #### Returns
687
+
688
+ `number`
689
+
690
+ #### Inherited from
691
+
692
+ [Input](../wiki/Input).[listenerCount](../wiki/Input#listenercount)
693
+
694
+ #### Defined in
695
+
696
+ node_modules/@types/node/events.d.ts:589
697
+
698
+ ___
699
+
700
+ ### listeners
701
+
702
+ ▸ **listeners**(`eventName`): `Function`[]
703
+
704
+ Returns a copy of the array of listeners for the event named `eventName`.
705
+
706
+ ```js
707
+ server.on('connection', (stream) => {
708
+ console.log('someone connected!');
709
+ });
710
+ console.log(util.inspect(server.listeners('connection')));
711
+ // Prints: [ [Function] ]
712
+ ```
713
+
714
+ **`since`** v0.1.26
715
+
716
+ #### Parameters
717
+
718
+ | Name | Type |
719
+ | :------ | :------ |
720
+ | `eventName` | `string` \| `symbol` |
721
+
722
+ #### Returns
723
+
724
+ `Function`[]
725
+
726
+ #### Inherited from
727
+
728
+ [Input](../wiki/Input).[listeners](../wiki/Input#listeners)
729
+
730
+ #### Defined in
731
+
732
+ node_modules/@types/node/events.d.ts:512
733
+
734
+ ___
735
+
736
+ ### next
737
+
738
+ ▸ **next**(): `Promise`<`IteratorResult`<[`Momentary`](../wiki/Momentary), `any`\>\>
739
+
740
+ Resolves on the next change to this input's state.
741
+
742
+ #### Returns
743
+
744
+ `Promise`<`IteratorResult`<[`Momentary`](../wiki/Momentary), `any`\>\>
745
+
746
+ #### Inherited from
747
+
748
+ [Input](../wiki/Input).[next](../wiki/Input#next)
749
+
750
+ #### Defined in
751
+
752
+ [src/input.ts:78](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L78)
753
+
754
+ ___
755
+
756
+ ### off
757
+
758
+ ▸ **off**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
759
+
760
+ Alias for `emitter.removeListener()`.
761
+
762
+ **`since`** v10.0.0
763
+
764
+ #### Parameters
765
+
766
+ | Name | Type |
767
+ | :------ | :------ |
768
+ | `eventName` | `string` \| `symbol` |
769
+ | `listener` | (...`args`: `any`[]) => `void` |
770
+
771
+ #### Returns
772
+
773
+ [`Momentary`](../wiki/Momentary)
774
+
775
+ #### Inherited from
776
+
777
+ [Input](../wiki/Input).[off](../wiki/Input#off)
778
+
779
+ #### Defined in
780
+
781
+ node_modules/@types/node/events.d.ts:472
782
+
783
+ ___
784
+
785
+ ### on
786
+
787
+ ▸ **on**(`event`, `listener`): [`Momentary`](../wiki/Momentary)
788
+
789
+ #### Parameters
790
+
791
+ | Name | Type |
792
+ | :------ | :------ |
793
+ | `event` | [`InputEvent`](../wiki/Exports#inputevent) |
794
+ | `listener` | (`input`: [`Input`](../wiki/Input)<`boolean`\>, `changed`: [`Input`](../wiki/Input)<`unknown`\>) => `unknown` |
795
+
796
+ #### Returns
797
+
798
+ [`Momentary`](../wiki/Momentary)
799
+
800
+ #### Inherited from
801
+
802
+ [Input](../wiki/Input).[on](../wiki/Input#on)
803
+
804
+ #### Defined in
805
+
806
+ [src/input.ts:37](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L37)
807
+
808
+ ___
809
+
810
+ ### once
811
+
812
+ ▸ **once**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
813
+
814
+ Adds a **one-time**`listener` function for the event named `eventName`. The
815
+ next time `eventName` is triggered, this listener is removed and then invoked.
816
+
817
+ ```js
818
+ server.once('connection', (stream) => {
819
+ console.log('Ah, we have our first user!');
820
+ });
821
+ ```
822
+
823
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
824
+
825
+ 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
826
+ event listener to the beginning of the listeners array.
827
+
828
+ ```js
829
+ const myEE = new EventEmitter();
830
+ myEE.once('foo', () => console.log('a'));
831
+ myEE.prependOnceListener('foo', () => console.log('b'));
832
+ myEE.emit('foo');
833
+ // Prints:
834
+ // b
835
+ // a
836
+ ```
837
+
838
+ **`since`** v0.3.0
839
+
840
+ #### Parameters
841
+
842
+ | Name | Type | Description |
843
+ | :------ | :------ | :------ |
844
+ | `eventName` | `string` \| `symbol` | The name of the event. |
845
+ | `listener` | (...`args`: `any`[]) => `void` | The callback function |
846
+
847
+ #### Returns
848
+
849
+ [`Momentary`](../wiki/Momentary)
850
+
851
+ #### Inherited from
852
+
853
+ [Input](../wiki/Input).[once](../wiki/Input#once)
854
+
855
+ #### Defined in
856
+
857
+ node_modules/@types/node/events.d.ts:387
858
+
859
+ ___
860
+
861
+ ### prependListener
862
+
863
+ ▸ **prependListener**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
864
+
865
+ Adds the `listener` function to the _beginning_ of the listeners array for the
866
+ event named `eventName`. No checks are made to see if the `listener` has
867
+ already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
868
+ times.
869
+
870
+ ```js
871
+ server.prependListener('connection', (stream) => {
872
+ console.log('someone connected!');
873
+ });
874
+ ```
875
+
876
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
877
+
878
+ **`since`** v6.0.0
879
+
880
+ #### Parameters
881
+
882
+ | Name | Type | Description |
883
+ | :------ | :------ | :------ |
884
+ | `eventName` | `string` \| `symbol` | The name of the event. |
885
+ | `listener` | (...`args`: `any`[]) => `void` | The callback function |
886
+
887
+ #### Returns
888
+
889
+ [`Momentary`](../wiki/Momentary)
890
+
891
+ #### Inherited from
892
+
893
+ [Input](../wiki/Input).[prependListener](../wiki/Input#prependlistener)
894
+
895
+ #### Defined in
896
+
897
+ node_modules/@types/node/events.d.ts:607
898
+
899
+ ___
900
+
901
+ ### prependOnceListener
902
+
903
+ ▸ **prependOnceListener**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
904
+
905
+ 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
906
+ listener is removed, and then invoked.
907
+
908
+ ```js
909
+ server.prependOnceListener('connection', (stream) => {
910
+ console.log('Ah, we have our first user!');
911
+ });
912
+ ```
913
+
914
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
915
+
916
+ **`since`** v6.0.0
917
+
918
+ #### Parameters
919
+
920
+ | Name | Type | Description |
921
+ | :------ | :------ | :------ |
922
+ | `eventName` | `string` \| `symbol` | The name of the event. |
923
+ | `listener` | (...`args`: `any`[]) => `void` | The callback function |
924
+
925
+ #### Returns
926
+
927
+ [`Momentary`](../wiki/Momentary)
928
+
929
+ #### Inherited from
930
+
931
+ [Input](../wiki/Input).[prependOnceListener](../wiki/Input#prependoncelistener)
932
+
933
+ #### Defined in
934
+
935
+ node_modules/@types/node/events.d.ts:623
936
+
937
+ ___
938
+
939
+ ### promise
940
+
941
+ ▸ **promise**(): `Promise`<[`Momentary`](../wiki/Momentary)\>
942
+
943
+ Resolves on the next change to this input's state.
944
+
945
+ #### Returns
946
+
947
+ `Promise`<[`Momentary`](../wiki/Momentary)\>
948
+
949
+ #### Inherited from
950
+
951
+ [Input](../wiki/Input).[promise](../wiki/Input#promise)
952
+
953
+ #### Defined in
954
+
955
+ [src/input.ts:89](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L89)
956
+
957
+ ___
958
+
959
+ ### rawListeners
960
+
961
+ ▸ **rawListeners**(`eventName`): `Function`[]
962
+
963
+ Returns a copy of the array of listeners for the event named `eventName`,
964
+ including any wrappers (such as those created by `.once()`).
965
+
966
+ ```js
967
+ const emitter = new EventEmitter();
968
+ emitter.once('log', () => console.log('log once'));
969
+
970
+ // Returns a new Array with a function `onceWrapper` which has a property
971
+ // `listener` which contains the original listener bound above
972
+ const listeners = emitter.rawListeners('log');
973
+ const logFnWrapper = listeners[0];
974
+
975
+ // Logs "log once" to the console and does not unbind the `once` event
976
+ logFnWrapper.listener();
977
+
978
+ // Logs "log once" to the console and removes the listener
979
+ logFnWrapper();
980
+
981
+ emitter.on('log', () => console.log('log persistently'));
982
+ // Will return a new Array with a single function bound by `.on()` above
983
+ const newListeners = emitter.rawListeners('log');
984
+
985
+ // Logs "log persistently" twice
986
+ newListeners[0]();
987
+ emitter.emit('log');
988
+ ```
989
+
990
+ **`since`** v9.4.0
991
+
992
+ #### Parameters
993
+
994
+ | Name | Type |
995
+ | :------ | :------ |
996
+ | `eventName` | `string` \| `symbol` |
997
+
998
+ #### Returns
999
+
1000
+ `Function`[]
1001
+
1002
+ #### Inherited from
1003
+
1004
+ [Input](../wiki/Input).[rawListeners](../wiki/Input#rawlisteners)
1005
+
1006
+ #### Defined in
1007
+
1008
+ node_modules/@types/node/events.d.ts:542
1009
+
1010
+ ___
1011
+
1012
+ ### removeAllListeners
1013
+
1014
+ ▸ **removeAllListeners**(`event?`): [`Momentary`](../wiki/Momentary)
1015
+
1016
+ Removes all listeners, or those of the specified `eventName`.
1017
+
1018
+ It is bad practice to remove listeners added elsewhere in the code,
1019
+ particularly when the `EventEmitter` instance was created by some other
1020
+ component or module (e.g. sockets or file streams).
1021
+
1022
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1023
+
1024
+ **`since`** v0.1.26
1025
+
1026
+ #### Parameters
1027
+
1028
+ | Name | Type |
1029
+ | :------ | :------ |
1030
+ | `event?` | `string` \| `symbol` |
1031
+
1032
+ #### Returns
1033
+
1034
+ [`Momentary`](../wiki/Momentary)
1035
+
1036
+ #### Inherited from
1037
+
1038
+ [Input](../wiki/Input).[removeAllListeners](../wiki/Input#removealllisteners)
1039
+
1040
+ #### Defined in
1041
+
1042
+ node_modules/@types/node/events.d.ts:483
1043
+
1044
+ ___
1045
+
1046
+ ### removeListener
1047
+
1048
+ ▸ **removeListener**(`eventName`, `listener`): [`Momentary`](../wiki/Momentary)
1049
+
1050
+ Removes the specified `listener` from the listener array for the event named`eventName`.
1051
+
1052
+ ```js
1053
+ const callback = (stream) => {
1054
+ console.log('someone connected!');
1055
+ };
1056
+ server.on('connection', callback);
1057
+ // ...
1058
+ server.removeListener('connection', callback);
1059
+ ```
1060
+
1061
+ `removeListener()` will remove, at most, one instance of a listener from the
1062
+ listener array. If any single listener has been added multiple times to the
1063
+ listener array for the specified `eventName`, then `removeListener()` must be
1064
+ called multiple times to remove each instance.
1065
+
1066
+ Once an event is emitted, all listeners attached to it at the
1067
+ 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
1068
+ not remove them from`emit()` in progress. Subsequent events behave as expected.
1069
+
1070
+ ```js
1071
+ const myEmitter = new MyEmitter();
1072
+
1073
+ const callbackA = () => {
1074
+ console.log('A');
1075
+ myEmitter.removeListener('event', callbackB);
1076
+ };
1077
+
1078
+ const callbackB = () => {
1079
+ console.log('B');
1080
+ };
1081
+
1082
+ myEmitter.on('event', callbackA);
1083
+
1084
+ myEmitter.on('event', callbackB);
1085
+
1086
+ // callbackA removes listener callbackB but it will still be called.
1087
+ // Internal listener array at time of emit [callbackA, callbackB]
1088
+ myEmitter.emit('event');
1089
+ // Prints:
1090
+ // A
1091
+ // B
1092
+
1093
+ // callbackB is now removed.
1094
+ // Internal listener array [callbackA]
1095
+ myEmitter.emit('event');
1096
+ // Prints:
1097
+ // A
1098
+ ```
1099
+
1100
+ Because listeners are managed using an internal array, calling this will
1101
+ change the position indices of any listener registered _after_ the listener
1102
+ being removed. This will not impact the order in which listeners are called,
1103
+ but it means that any copies of the listener array as returned by
1104
+ the `emitter.listeners()` method will need to be recreated.
1105
+
1106
+ When a single function has been added as a handler multiple times for a single
1107
+ event (as in the example below), `removeListener()` will remove the most
1108
+ recently added instance. In the example the `once('ping')`listener is removed:
1109
+
1110
+ ```js
1111
+ const ee = new EventEmitter();
1112
+
1113
+ function pong() {
1114
+ console.log('pong');
1115
+ }
1116
+
1117
+ ee.on('ping', pong);
1118
+ ee.once('ping', pong);
1119
+ ee.removeListener('ping', pong);
1120
+
1121
+ ee.emit('ping');
1122
+ ee.emit('ping');
1123
+ ```
1124
+
1125
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1126
+
1127
+ **`since`** v0.1.26
1128
+
1129
+ #### Parameters
1130
+
1131
+ | Name | Type |
1132
+ | :------ | :------ |
1133
+ | `eventName` | `string` \| `symbol` |
1134
+ | `listener` | (...`args`: `any`[]) => `void` |
1135
+
1136
+ #### Returns
1137
+
1138
+ [`Momentary`](../wiki/Momentary)
1139
+
1140
+ #### Inherited from
1141
+
1142
+ [Input](../wiki/Input).[removeListener](../wiki/Input#removelistener)
1143
+
1144
+ #### Defined in
1145
+
1146
+ node_modules/@types/node/events.d.ts:467
1147
+
1148
+ ___
1149
+
1150
+ ### setMaxListeners
1151
+
1152
+ ▸ **setMaxListeners**(`n`): [`Momentary`](../wiki/Momentary)
1153
+
1154
+ By default `EventEmitter`s will print a warning if more than `10` listeners are
1155
+ added for a particular event. This is a useful default that helps finding
1156
+ memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
1157
+ modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
1158
+
1159
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1160
+
1161
+ **`since`** v0.3.5
1162
+
1163
+ #### Parameters
1164
+
1165
+ | Name | Type |
1166
+ | :------ | :------ |
1167
+ | `n` | `number` |
1168
+
1169
+ #### Returns
1170
+
1171
+ [`Momentary`](../wiki/Momentary)
1172
+
1173
+ #### Inherited from
1174
+
1175
+ [Input](../wiki/Input).[setMaxListeners](../wiki/Input#setmaxlisteners)
1176
+
1177
+ #### Defined in
1178
+
1179
+ node_modules/@types/node/events.d.ts:493
1180
+
1181
+ ___
1182
+
1183
+ ### toString
1184
+
1185
+ ▸ **toString**(): `string`
1186
+
1187
+ Render a convenient debugging string.
1188
+
1189
+ #### Returns
1190
+
1191
+ `string`
1192
+
1193
+ #### Inherited from
1194
+
1195
+ [Input](../wiki/Input).[toString](../wiki/Input#tostring)
1196
+
1197
+ #### Defined in
1198
+
1199
+ [src/input.ts:98](https://github.com/nsfm/dualsense-ts/blob/6dc1604/src/input.ts#L98)
1200
+
1201
+ ___
1202
+
1203
+ ### getEventListeners
1204
+
1205
+ ▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[]
1206
+
1207
+ Returns a copy of the array of listeners for the event named `eventName`.
1208
+
1209
+ For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
1210
+ the emitter.
1211
+
1212
+ For `EventTarget`s this is the only way to get the event listeners for the
1213
+ event target. This is useful for debugging and diagnostic purposes.
1214
+
1215
+ ```js
1216
+ const { getEventListeners, EventEmitter } = require('events');
1217
+
1218
+ {
1219
+ const ee = new EventEmitter();
1220
+ const listener = () => console.log('Events are fun');
1221
+ ee.on('foo', listener);
1222
+ getEventListeners(ee, 'foo'); // [listener]
1223
+ }
1224
+ {
1225
+ const et = new EventTarget();
1226
+ const listener = () => console.log('Events are fun');
1227
+ et.addEventListener('foo', listener);
1228
+ getEventListeners(et, 'foo'); // [listener]
1229
+ }
1230
+ ```
1231
+
1232
+ **`since`** v15.2.0, v14.17.0
1233
+
1234
+ #### Parameters
1235
+
1236
+ | Name | Type |
1237
+ | :------ | :------ |
1238
+ | `emitter` | `EventEmitter` \| `DOMEventTarget` |
1239
+ | `name` | `string` \| `symbol` |
1240
+
1241
+ #### Returns
1242
+
1243
+ `Function`[]
1244
+
1245
+ #### Inherited from
1246
+
1247
+ [Input](../wiki/Input).[getEventListeners](../wiki/Input#geteventlisteners)
1248
+
1249
+ #### Defined in
1250
+
1251
+ node_modules/@types/node/events.d.ts:270
1252
+
1253
+ ___
1254
+
1255
+ ### listenerCount
1256
+
1257
+ ▸ `Static` **listenerCount**(`emitter`, `eventName`): `number`
1258
+
1259
+ A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
1260
+
1261
+ ```js
1262
+ const { EventEmitter, listenerCount } = require('events');
1263
+ const myEmitter = new EventEmitter();
1264
+ myEmitter.on('event', () => {});
1265
+ myEmitter.on('event', () => {});
1266
+ console.log(listenerCount(myEmitter, 'event'));
1267
+ // Prints: 2
1268
+ ```
1269
+
1270
+ **`since`** v0.9.12
1271
+
1272
+ **`deprecated`** Since v3.2.0 - Use `listenerCount` instead.
1273
+
1274
+ #### Parameters
1275
+
1276
+ | Name | Type | Description |
1277
+ | :------ | :------ | :------ |
1278
+ | `emitter` | `EventEmitter` | The emitter to query |
1279
+ | `eventName` | `string` \| `symbol` | The event name |
1280
+
1281
+ #### Returns
1282
+
1283
+ `number`
1284
+
1285
+ #### Inherited from
1286
+
1287
+ [Input](../wiki/Input).[listenerCount](../wiki/Input#listenercount-1)
1288
+
1289
+ #### Defined in
1290
+
1291
+ node_modules/@types/node/events.d.ts:242
1292
+
1293
+ ___
1294
+
1295
+ ### on
1296
+
1297
+ ▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\>
1298
+
1299
+ ```js
1300
+ const { on, EventEmitter } = require('events');
1301
+
1302
+ (async () => {
1303
+ const ee = new EventEmitter();
1304
+
1305
+ // Emit later on
1306
+ process.nextTick(() => {
1307
+ ee.emit('foo', 'bar');
1308
+ ee.emit('foo', 42);
1309
+ });
1310
+
1311
+ for await (const event of on(ee, 'foo')) {
1312
+ // The execution of this inner block is synchronous and it
1313
+ // processes one event at a time (even with await). Do not use
1314
+ // if concurrent execution is required.
1315
+ console.log(event); // prints ['bar'] [42]
1316
+ }
1317
+ // Unreachable here
1318
+ })();
1319
+ ```
1320
+
1321
+ Returns an `AsyncIterator` that iterates `eventName` events. It will throw
1322
+ if the `EventEmitter` emits `'error'`. It removes all listeners when
1323
+ exiting the loop. The `value` returned by each iteration is an array
1324
+ composed of the emitted event arguments.
1325
+
1326
+ An `AbortSignal` can be used to cancel waiting on events:
1327
+
1328
+ ```js
1329
+ const { on, EventEmitter } = require('events');
1330
+ const ac = new AbortController();
1331
+
1332
+ (async () => {
1333
+ const ee = new EventEmitter();
1334
+
1335
+ // Emit later on
1336
+ process.nextTick(() => {
1337
+ ee.emit('foo', 'bar');
1338
+ ee.emit('foo', 42);
1339
+ });
1340
+
1341
+ for await (const event of on(ee, 'foo', { signal: ac.signal })) {
1342
+ // The execution of this inner block is synchronous and it
1343
+ // processes one event at a time (even with await). Do not use
1344
+ // if concurrent execution is required.
1345
+ console.log(event); // prints ['bar'] [42]
1346
+ }
1347
+ // Unreachable here
1348
+ })();
1349
+
1350
+ process.nextTick(() => ac.abort());
1351
+ ```
1352
+
1353
+ **`since`** v13.6.0, v12.16.0
1354
+
1355
+ #### Parameters
1356
+
1357
+ | Name | Type | Description |
1358
+ | :------ | :------ | :------ |
1359
+ | `emitter` | `EventEmitter` | - |
1360
+ | `eventName` | `string` | The name of the event being listened for |
1361
+ | `options?` | `StaticEventEmitterOptions` | - |
1362
+
1363
+ #### Returns
1364
+
1365
+ `AsyncIterableIterator`<`any`\>
1366
+
1367
+ that iterates `eventName` events emitted by the `emitter`
1368
+
1369
+ #### Inherited from
1370
+
1371
+ [Input](../wiki/Input).[on](../wiki/Input#on-1)
1372
+
1373
+ #### Defined in
1374
+
1375
+ node_modules/@types/node/events.d.ts:221
1376
+
1377
+ ___
1378
+
1379
+ ### once
1380
+
1381
+ ▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\>
1382
+
1383
+ Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
1384
+ event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
1385
+ The `Promise` will resolve with an array of all the arguments emitted to the
1386
+ given event.
1387
+
1388
+ 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
1389
+ semantics and does not listen to the `'error'` event.
1390
+
1391
+ ```js
1392
+ const { once, EventEmitter } = require('events');
1393
+
1394
+ async function run() {
1395
+ const ee = new EventEmitter();
1396
+
1397
+ process.nextTick(() => {
1398
+ ee.emit('myevent', 42);
1399
+ });
1400
+
1401
+ const [value] = await once(ee, 'myevent');
1402
+ console.log(value);
1403
+
1404
+ const err = new Error('kaboom');
1405
+ process.nextTick(() => {
1406
+ ee.emit('error', err);
1407
+ });
1408
+
1409
+ try {
1410
+ await once(ee, 'myevent');
1411
+ } catch (err) {
1412
+ console.log('error happened', err);
1413
+ }
1414
+ }
1415
+
1416
+ run();
1417
+ ```
1418
+
1419
+ 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
1420
+ '`error'` event itself, then it is treated as any other kind of event without
1421
+ special handling:
1422
+
1423
+ ```js
1424
+ const { EventEmitter, once } = require('events');
1425
+
1426
+ const ee = new EventEmitter();
1427
+
1428
+ once(ee, 'error')
1429
+ .then(([err]) => console.log('ok', err.message))
1430
+ .catch((err) => console.log('error', err.message));
1431
+
1432
+ ee.emit('error', new Error('boom'));
1433
+
1434
+ // Prints: ok boom
1435
+ ```
1436
+
1437
+ An `AbortSignal` can be used to cancel waiting for the event:
1438
+
1439
+ ```js
1440
+ const { EventEmitter, once } = require('events');
1441
+
1442
+ const ee = new EventEmitter();
1443
+ const ac = new AbortController();
1444
+
1445
+ async function foo(emitter, event, signal) {
1446
+ try {
1447
+ await once(emitter, event, { signal });
1448
+ console.log('event emitted!');
1449
+ } catch (error) {
1450
+ if (error.name === 'AbortError') {
1451
+ console.error('Waiting for the event was canceled!');
1452
+ } else {
1453
+ console.error('There was an error', error.message);
1454
+ }
1455
+ }
1456
+ }
1457
+
1458
+ foo(ee, 'foo', ac.signal);
1459
+ ac.abort(); // Abort waiting for the event
1460
+ ee.emit('foo'); // Prints: Waiting for the event was canceled!
1461
+ ```
1462
+
1463
+ **`since`** v11.13.0, v10.16.0
1464
+
1465
+ #### Parameters
1466
+
1467
+ | Name | Type |
1468
+ | :------ | :------ |
1469
+ | `emitter` | `NodeEventTarget` |
1470
+ | `eventName` | `string` \| `symbol` |
1471
+ | `options?` | `StaticEventEmitterOptions` |
1472
+
1473
+ #### Returns
1474
+
1475
+ `Promise`<`any`[]\>
1476
+
1477
+ #### Inherited from
1478
+
1479
+ [Input](../wiki/Input).[once](../wiki/Input#once-1)
1480
+
1481
+ #### Defined in
1482
+
1483
+ node_modules/@types/node/events.d.ts:157
1484
+
1485
+ ▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\>
1486
+
1487
+ #### Parameters
1488
+
1489
+ | Name | Type |
1490
+ | :------ | :------ |
1491
+ | `emitter` | `DOMEventTarget` |
1492
+ | `eventName` | `string` |
1493
+ | `options?` | `StaticEventEmitterOptions` |
1494
+
1495
+ #### Returns
1496
+
1497
+ `Promise`<`any`[]\>
1498
+
1499
+ #### Inherited from
1500
+
1501
+ [Input](../wiki/Input).[once](../wiki/Input#once-1)
1502
+
1503
+ #### Defined in
1504
+
1505
+ node_modules/@types/node/events.d.ts:162
1506
+
1507
+ ___
1508
+
1509
+ ### setMaxListeners
1510
+
1511
+ ▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void`
1512
+
1513
+ By default `EventEmitter`s will print a warning if more than `10` listeners are
1514
+ added for a particular event. This is a useful default that helps finding
1515
+ memory leaks. The `EventEmitter.setMaxListeners()` method allows the default limit to be
1516
+ modified (if eventTargets is empty) or modify the limit specified in every `EventTarget` | `EventEmitter` passed as arguments.
1517
+ The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
1518
+
1519
+ ```js
1520
+ EventEmitter.setMaxListeners(20);
1521
+ // Equivalent to
1522
+ EventEmitter.defaultMaxListeners = 20;
1523
+
1524
+ const eventTarget = new EventTarget();
1525
+ // Only way to increase limit for `EventTarget` instances
1526
+ // as these doesn't expose its own `setMaxListeners` method
1527
+ EventEmitter.setMaxListeners(20, eventTarget);
1528
+ ```
1529
+
1530
+ **`since`** v15.3.0, v14.17.0
1531
+
1532
+ #### Parameters
1533
+
1534
+ | Name | Type |
1535
+ | :------ | :------ |
1536
+ | `n?` | `number` |
1537
+ | `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] |
1538
+
1539
+ #### Returns
1540
+
1541
+ `void`
1542
+
1543
+ #### Inherited from
1544
+
1545
+ [Input](../wiki/Input).[setMaxListeners](../wiki/Input#setmaxlisteners-1)
1546
+
1547
+ #### Defined in
1548
+
1549
+ node_modules/@types/node/events.d.ts:290