@irrelon/emitter 6.1.0 → 6.2.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/doc/Emitter.html CHANGED
@@ -28,9 +28,9 @@
28
28
 
29
29
  <header>
30
30
 
31
- <h2><span class="attribs"><span class="type-signature"></span></span>Emitter<span class="signature">(obj, prototypeMode)</span><span class="type-signature"></span></h2>
31
+ <h2><span class="attribs"><span class="type-signature"></span></span>Emitter<span class="signature">()</span><span class="type-signature"></span></h2>
32
32
 
33
- <div class="class-description">Emitter</div>
33
+ <div class="class-description">Creates a new class with the ability to emit events.</div>
34
34
 
35
35
 
36
36
  </header>
@@ -45,7 +45,7 @@
45
45
 
46
46
 
47
47
 
48
- <h4 class="name" id="Emitter"><span class="type-signature"></span>new Emitter<span class="signature">(obj, prototypeMode)</span><span class="type-signature"></span></h4>
48
+ <h4 class="name" id="Emitter"><span class="type-signature"></span>new Emitter<span class="signature">()</span><span class="type-signature"></span></h4>
49
49
 
50
50
 
51
51
 
@@ -60,76 +60,6 @@
60
60
 
61
61
 
62
62
 
63
- <h5>Parameters:</h5>
64
-
65
-
66
- <table class="params">
67
- <thead>
68
- <tr>
69
-
70
- <th>Name</th>
71
-
72
-
73
- <th>Type</th>
74
-
75
-
76
-
77
-
78
-
79
- <th class="last">Description</th>
80
- </tr>
81
- </thead>
82
-
83
- <tbody>
84
-
85
-
86
- <tr>
87
-
88
- <td class="name"><code>obj</code></td>
89
-
90
-
91
- <td class="type">
92
-
93
- </td>
94
-
95
-
96
-
97
-
98
-
99
- <td class="description last"></td>
100
- </tr>
101
-
102
-
103
-
104
- <tr>
105
-
106
- <td class="name"><code>prototypeMode</code></td>
107
-
108
-
109
- <td class="type">
110
-
111
-
112
- <span class="param-type">Boolean</span>
113
-
114
-
115
-
116
- </td>
117
-
118
-
119
-
120
-
121
-
122
- <td class="description last">Defaults to true. Set to true to add emitter
123
- methods to the the passed object's prototype property e.g. obj.prototype.on
124
- = emitter.on. Set to false to add emitter methods the object directly e.g.
125
- obj.on = emitter.on.</td>
126
- </tr>
127
-
128
-
129
- </tbody>
130
- </table>
131
-
132
-
133
63
 
134
64
 
135
65
 
@@ -163,7 +93,7 @@ obj.on = emitter.on.</td>
163
93
 
164
94
  <dt class="tag-source">Source:</dt>
165
95
  <dd class="tag-source"><ul class="dummy"><li>
166
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line801">line 801</a>
96
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line9">line 9</a>
167
97
  </li></ul></dd>
168
98
 
169
99
 
@@ -191,6 +121,8 @@ obj.on = emitter.on.</td>
191
121
 
192
122
 
193
123
 
124
+
125
+
194
126
 
195
127
  </div>
196
128
 
@@ -199,6 +131,13 @@ obj.on = emitter.on.</td>
199
131
 
200
132
 
201
133
 
134
+ <h3 class="subsection-title">Classes</h3>
135
+
136
+ <dl>
137
+ <dt><a href="Emitter.html">Emitter</a></dt>
138
+ <dd></dd>
139
+ </dl>
140
+
202
141
 
203
142
 
204
143
 
@@ -217,7 +156,7 @@ obj.on = emitter.on.</td>
217
156
 
218
157
 
219
158
 
220
- <h4 class="name" id=".deferEmit"><span class="type-signature">(static) </span>deferEmit<span class="signature">(eventName, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
159
+ <h4 class="name" id="_emitToWindowDispatch"><span class="type-signature"></span>_emitToWindowDispatch<span class="signature">(eventName, data)</span><span class="type-signature"></span></h4>
221
160
 
222
161
 
223
162
 
@@ -225,11 +164,8 @@ obj.on = emitter.on.</td>
225
164
 
226
165
 
227
166
  <div class="description">
228
- Queues an event to be fired. This has automatic de-bouncing so that any
229
- events of the same type that occur within 100 milliseconds of a previous
230
- one will all be wrapped into a single emit rather than emitting tons of
231
- events for lots of chained inserts etc. Only the data from the last
232
- de-bounced event will be emitted.
167
+ Dispatches an event originating in our emitter to the browser's
168
+ window object.
233
169
  </div>
234
170
 
235
171
 
@@ -253,8 +189,6 @@ de-bounced event will be emitted.
253
189
  <th>Type</th>
254
190
 
255
191
 
256
- <th>Attributes</th>
257
-
258
192
 
259
193
 
260
194
 
@@ -272,26 +206,14 @@ de-bounced event will be emitted.
272
206
 
273
207
  <td class="type">
274
208
 
275
-
276
- <span class="param-type">String</span>
277
-
278
-
279
-
280
209
  </td>
281
210
 
282
211
 
283
- <td class="attributes">
284
-
285
-
286
-
287
-
288
-
289
- </td>
290
-
291
212
 
292
213
 
293
214
 
294
- <td class="description last">The name of the event to emit.</td>
215
+ <td class="description last">The name of the event to emit. This gets prefixed with the
216
+ dispatch prefix if one is set.</td>
295
217
  </tr>
296
218
 
297
219
 
@@ -303,28 +225,13 @@ de-bounced event will be emitted.
303
225
 
304
226
  <td class="type">
305
227
 
306
-
307
- <span class="param-type">*</span>
308
-
309
-
310
-
311
228
  </td>
312
229
 
313
230
 
314
- <td class="attributes">
315
-
316
- &lt;optional><br>
317
-
318
-
319
-
320
-
321
-
322
- </td>
323
-
324
231
 
325
232
 
326
233
 
327
- <td class="description last">Optional data to emit with the event.</td>
234
+ <td class="description last"></td>
328
235
  </tr>
329
236
 
330
237
 
@@ -365,7 +272,7 @@ de-bounced event will be emitted.
365
272
 
366
273
  <dt class="tag-source">Source:</dt>
367
274
  <dd class="tag-source"><ul class="dummy"><li>
368
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line756">line 756</a>
275
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line199">line 199</a>
369
276
  </li></ul></dd>
370
277
 
371
278
 
@@ -393,13 +300,15 @@ de-bounced event will be emitted.
393
300
 
394
301
 
395
302
 
303
+
304
+
396
305
 
397
306
 
398
307
 
399
308
 
400
309
 
401
310
 
402
- <h4 class="name" id=".emit"><span class="type-signature">(static) </span>emit<span class="signature">(event)</span><span class="type-signature"> &rarr; {*}</span></h4>
311
+ <h4 class="name" id="_off"><span class="type-signature"></span>_off<span class="signature">(eventName, id, listener)</span><span class="type-signature"></span></h4>
403
312
 
404
313
 
405
314
 
@@ -407,7 +316,7 @@ de-bounced event will be emitted.
407
316
 
408
317
 
409
318
  <div class="description">
410
- Emit an event.
319
+ Cancels an event listener based on an event name, id and listener function.
411
320
  </div>
412
321
 
413
322
 
@@ -443,15 +352,46 @@ de-bounced event will be emitted.
443
352
 
444
353
  <tr>
445
354
 
446
- <td class="name"><code>event</code></td>
355
+ <td class="name"><code>eventName</code></td>
447
356
 
448
357
 
449
358
  <td class="type">
450
359
 
451
-
452
- <span class="param-type">String</span>
360
+ </td>
361
+
362
+
363
+
364
+
365
+
366
+ <td class="description last">The event to cancel listener for.</td>
367
+ </tr>
368
+
369
+
370
+
371
+ <tr>
372
+
373
+ <td class="name"><code>id</code></td>
374
+
375
+
376
+ <td class="type">
377
+
378
+ </td>
379
+
380
+
381
+
382
+
383
+
384
+ <td class="description last">The ID of the event to cancel listening for.</td>
385
+ </tr>
453
386
 
387
+
388
+
389
+ <tr>
390
+
391
+ <td class="name"><code>listener</code></td>
392
+
454
393
 
394
+ <td class="type">
455
395
 
456
396
  </td>
457
397
 
@@ -459,7 +399,8 @@ de-bounced event will be emitted.
459
399
 
460
400
 
461
401
 
462
- <td class="description last">The event to emit.</td>
402
+ <td class="description last">The event listener function used in the on()
403
+ or once() call to cancel.</td>
463
404
  </tr>
464
405
 
465
406
 
@@ -500,7 +441,7 @@ de-bounced event will be emitted.
500
441
 
501
442
  <dt class="tag-source">Source:</dt>
502
443
  <dd class="tag-source"><ul class="dummy"><li>
503
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line304">line 304</a>
444
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line87">line 87</a>
504
445
  </li></ul></dd>
505
446
 
506
447
 
@@ -523,22 +464,16 @@ de-bounced event will be emitted.
523
464
 
524
465
 
525
466
 
526
- <h5>Returns:</h5>
527
467
 
528
-
529
468
 
469
+ <h5>Returns:</h5>
530
470
 
531
- <dl>
532
- <dt>
533
- Type
534
- </dt>
535
- <dd>
536
471
 
537
- <span class="param-type">*</span>
472
+ <div class="param-desc">
473
+ The emitter instance.
474
+ </div>
538
475
 
539
476
 
540
- </dd>
541
- </dl>
542
477
 
543
478
 
544
479
 
@@ -552,7 +487,7 @@ de-bounced event will be emitted.
552
487
 
553
488
 
554
489
 
555
- <h4 class="name" id=".emit"><span class="type-signature">(static) </span>emit<span class="signature">(event, data)</span><span class="type-signature"> &rarr; {*}</span></h4>
490
+ <h4 class="name" id="_on"><span class="type-signature"></span>_on<span class="signature">(eventName, id, listener)</span><span class="type-signature"></span></h4>
556
491
 
557
492
 
558
493
 
@@ -560,7 +495,8 @@ de-bounced event will be emitted.
560
495
 
561
496
 
562
497
  <div class="description">
563
- Emit an event with data.
498
+ Attach an event listener to the passed event only if the passed
499
+ id matches the id for the event being fired.
564
500
  </div>
565
501
 
566
502
 
@@ -596,38 +532,46 @@ de-bounced event will be emitted.
596
532
 
597
533
  <tr>
598
534
 
599
- <td class="name"><code>event</code></td>
535
+ <td class="name"><code>eventName</code></td>
600
536
 
601
537
 
602
538
  <td class="type">
603
539
 
604
-
605
- <span class="param-type">String</span>
606
-
607
-
608
-
609
540
  </td>
610
541
 
611
542
 
612
543
 
613
544
 
614
545
 
615
- <td class="description last">The event to emit.</td>
546
+ <td class="description last">The name of the event to listen for.</td>
616
547
  </tr>
617
548
 
618
549
 
619
550
 
620
551
  <tr>
621
552
 
622
- <td class="name"><code>data</code></td>
553
+ <td class="name"><code>id</code></td>
623
554
 
624
555
 
625
556
  <td class="type">
626
557
 
627
-
628
- <span class="param-type">*</span>
558
+ </td>
559
+
560
+
561
+
562
+
629
563
 
564
+ <td class="description last">The id to match against.</td>
565
+ </tr>
566
+
567
+
568
+
569
+ <tr>
570
+
571
+ <td class="name"><code>listener</code></td>
572
+
630
573
 
574
+ <td class="type">
631
575
 
632
576
  </td>
633
577
 
@@ -635,7 +579,7 @@ de-bounced event will be emitted.
635
579
 
636
580
 
637
581
 
638
- <td class="description last">Data to emit with the event.</td>
582
+ <td class="description last">The method to call when the event is fired.</td>
639
583
  </tr>
640
584
 
641
585
 
@@ -676,7 +620,7 @@ de-bounced event will be emitted.
676
620
 
677
621
  <dt class="tag-source">Source:</dt>
678
622
  <dd class="tag-source"><ul class="dummy"><li>
679
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line316">line 316</a>
623
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line33">line 33</a>
680
624
  </li></ul></dd>
681
625
 
682
626
 
@@ -699,22 +643,16 @@ de-bounced event will be emitted.
699
643
 
700
644
 
701
645
 
702
- <h5>Returns:</h5>
703
646
 
704
-
705
647
 
648
+ <h5>Returns:</h5>
706
649
 
707
- <dl>
708
- <dt>
709
- Type
710
- </dt>
711
- <dd>
712
650
 
713
- <span class="param-type">*</span>
651
+ <div class="param-desc">
652
+ The emitter instance.
653
+ </div>
714
654
 
715
655
 
716
- </dd>
717
- </dl>
718
656
 
719
657
 
720
658
 
@@ -728,7 +666,7 @@ de-bounced event will be emitted.
728
666
 
729
667
 
730
668
 
731
- <h4 class="name" id=".emitStatic"><span class="type-signature">(static) </span>emitStatic<span class="signature">(event)</span><span class="type-signature"> &rarr; {*}</span></h4>
669
+ <h4 class="name" id="_once"><span class="type-signature"></span>_once<span class="signature">(eventName, id, listener)</span><span class="type-signature"></span></h4>
732
670
 
733
671
 
734
672
 
@@ -736,8 +674,8 @@ de-bounced event will be emitted.
736
674
 
737
675
 
738
676
  <div class="description">
739
- Emit an event that will fire on listeners even when the listener
740
- is registered AFTER the event has been emitted.
677
+ Attach an event listener to the passed event only if the passed
678
+ id matches the document id for the event being fired.
741
679
  </div>
742
680
 
743
681
 
@@ -773,15 +711,46 @@ is registered AFTER the event has been emitted.
773
711
 
774
712
  <tr>
775
713
 
776
- <td class="name"><code>event</code></td>
714
+ <td class="name"><code>eventName</code></td>
777
715
 
778
716
 
779
717
  <td class="type">
780
718
 
781
-
782
- <span class="param-type">String</span>
719
+ </td>
720
+
721
+
722
+
723
+
724
+
725
+ <td class="description last">The name of the event to listen for.</td>
726
+ </tr>
727
+
728
+
729
+
730
+ <tr>
731
+
732
+ <td class="name"><code>id</code></td>
733
+
734
+
735
+ <td class="type">
736
+
737
+ </td>
738
+
739
+
740
+
741
+
742
+
743
+ <td class="description last">The id to match against.</td>
744
+ </tr>
745
+
746
+
783
747
 
748
+ <tr>
749
+
750
+ <td class="name"><code>listener</code></td>
751
+
784
752
 
753
+ <td class="type">
785
754
 
786
755
  </td>
787
756
 
@@ -789,7 +758,7 @@ is registered AFTER the event has been emitted.
789
758
 
790
759
 
791
760
 
792
- <td class="description last">The event to emit.</td>
761
+ <td class="description last">The method to call when the event is fired.</td>
793
762
  </tr>
794
763
 
795
764
 
@@ -830,7 +799,7 @@ is registered AFTER the event has been emitted.
830
799
 
831
800
  <dt class="tag-source">Source:</dt>
832
801
  <dd class="tag-source"><ul class="dummy"><li>
833
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line437">line 437</a>
802
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line66">line 66</a>
834
803
  </li></ul></dd>
835
804
 
836
805
 
@@ -853,22 +822,16 @@ is registered AFTER the event has been emitted.
853
822
 
854
823
 
855
824
 
856
- <h5>Returns:</h5>
857
825
 
858
-
859
826
 
827
+ <h5>Returns:</h5>
860
828
 
861
- <dl>
862
- <dt>
863
- Type
864
- </dt>
865
- <dd>
866
829
 
867
- <span class="param-type">*</span>
830
+ <div class="param-desc">
831
+ The emitter instance.
832
+ </div>
868
833
 
869
834
 
870
- </dd>
871
- </dl>
872
835
 
873
836
 
874
837
 
@@ -882,7 +845,7 @@ is registered AFTER the event has been emitted.
882
845
 
883
846
 
884
847
 
885
- <h4 class="name" id=".emitStatic"><span class="type-signature">(static) </span>emitStatic<span class="signature">(event, data)</span><span class="type-signature"> &rarr; {*}</span></h4>
848
+ <h4 class="name" id="deferEmit"><span class="type-signature"></span>deferEmit<span class="signature">(eventName, &hellip;data)</span><span class="type-signature"></span></h4>
886
849
 
887
850
 
888
851
 
@@ -890,8 +853,11 @@ is registered AFTER the event has been emitted.
890
853
 
891
854
 
892
855
  <div class="description">
893
- Emit an event with data that will fire on listeners even when the listener
894
- is registered AFTER the event has been emitted.
856
+ Queues an event to be fired. This has automatic de-bouncing so that any
857
+ events of the same type that occur within 100 milliseconds of a previous
858
+ one will all be wrapped into a single emit rather than emitting tons of
859
+ events for lots of chained inserts etc. Only the data from the last
860
+ de-bounced event will be emitted.
895
861
  </div>
896
862
 
897
863
 
@@ -915,6 +881,8 @@ is registered AFTER the event has been emitted.
915
881
  <th>Type</th>
916
882
 
917
883
 
884
+ <th>Attributes</th>
885
+
918
886
 
919
887
 
920
888
 
@@ -927,23 +895,26 @@ is registered AFTER the event has been emitted.
927
895
 
928
896
  <tr>
929
897
 
930
- <td class="name"><code>event</code></td>
898
+ <td class="name"><code>eventName</code></td>
931
899
 
932
900
 
933
901
  <td class="type">
934
902
 
903
+ </td>
904
+
905
+
906
+ <td class="attributes">
935
907
 
936
- <span class="param-type">String</span>
937
908
 
909
+
938
910
 
911
+
912
+ </td>
939
913
 
940
- </td>
941
914
 
942
915
 
943
916
 
944
-
945
-
946
- <td class="description last">The event to emit.</td>
917
+ <td class="description last">The name of the event to emit.</td>
947
918
  </tr>
948
919
 
949
920
 
@@ -956,17 +927,27 @@ is registered AFTER the event has been emitted.
956
927
  <td class="type">
957
928
 
958
929
 
959
- <span class="param-type">*</span>
930
+ <span class="param-type">any</span>
960
931
 
961
932
 
962
933
 
963
934
  </td>
964
935
 
965
936
 
937
+ <td class="attributes">
938
+
939
+
940
+
941
+
942
+
943
+ &lt;repeatable><br>
944
+
945
+ </td>
946
+
966
947
 
967
948
 
968
949
 
969
- <td class="description last">Data to emit with the event.</td>
950
+ <td class="description last">Optional arguments to emit with the event.</td>
970
951
  </tr>
971
952
 
972
953
 
@@ -1007,7 +988,7 @@ is registered AFTER the event has been emitted.
1007
988
 
1008
989
  <dt class="tag-source">Source:</dt>
1009
990
  <dd class="tag-source"><ul class="dummy"><li>
1010
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line450">line 450</a>
991
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line514">line 514</a>
1011
992
  </li></ul></dd>
1012
993
 
1013
994
 
@@ -1030,22 +1011,16 @@ is registered AFTER the event has been emitted.
1030
1011
 
1031
1012
 
1032
1013
 
1033
- <h5>Returns:</h5>
1034
1014
 
1035
-
1036
1015
 
1016
+ <h5>Returns:</h5>
1037
1017
 
1038
- <dl>
1039
- <dt>
1040
- Type
1041
- </dt>
1042
- <dd>
1043
1018
 
1044
- <span class="param-type">*</span>
1019
+ <div class="param-desc">
1020
+ The emitter instance.
1021
+ </div>
1045
1022
 
1046
1023
 
1047
- </dd>
1048
- </dl>
1049
1024
 
1050
1025
 
1051
1026
 
@@ -1059,7 +1034,7 @@ is registered AFTER the event has been emitted.
1059
1034
 
1060
1035
 
1061
1036
 
1062
- <h4 class="name" id=".emitStatic"><span class="type-signature">(static) </span>emitStatic<span class="signature">(event)</span><span class="type-signature"> &rarr; {*}</span></h4>
1037
+ <h4 class="name" id="didCancel"><span class="type-signature"></span>didCancel<span class="signature">(resultArr)</span><span class="type-signature"></span></h4>
1063
1038
 
1064
1039
 
1065
1040
 
@@ -1067,7 +1042,8 @@ is registered AFTER the event has been emitted.
1067
1042
 
1068
1043
 
1069
1044
  <div class="description">
1070
- Remove a static event emitter.
1045
+ Returns true if the result from an emit() call passed as the first
1046
+ argument contains a cancellation flag.
1071
1047
  </div>
1072
1048
 
1073
1049
 
@@ -1103,23 +1079,18 @@ is registered AFTER the event has been emitted.
1103
1079
 
1104
1080
  <tr>
1105
1081
 
1106
- <td class="name"><code>event</code></td>
1082
+ <td class="name"><code>resultArr</code></td>
1107
1083
 
1108
1084
 
1109
1085
  <td class="type">
1110
1086
 
1111
-
1112
- <span class="param-type">String</span>
1113
-
1114
-
1115
-
1116
1087
  </td>
1117
1088
 
1118
1089
 
1119
1090
 
1120
1091
 
1121
1092
 
1122
- <td class="description last">The event to remove static emitter for.</td>
1093
+ <td class="description last"></td>
1123
1094
  </tr>
1124
1095
 
1125
1096
 
@@ -1160,7 +1131,7 @@ is registered AFTER the event has been emitted.
1160
1131
 
1161
1132
  <dt class="tag-source">Source:</dt>
1162
1133
  <dd class="tag-source"><ul class="dummy"><li>
1163
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line621">line 621</a>
1134
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line536">line 536</a>
1164
1135
  </li></ul></dd>
1165
1136
 
1166
1137
 
@@ -1183,24 +1154,8 @@ is registered AFTER the event has been emitted.
1183
1154
 
1184
1155
 
1185
1156
 
1186
- <h5>Returns:</h5>
1187
-
1188
-
1189
-
1190
-
1191
- <dl>
1192
- <dt>
1193
- Type
1194
- </dt>
1195
- <dd>
1196
-
1197
- <span class="param-type">*</span>
1198
-
1199
1157
 
1200
- </dd>
1201
- </dl>
1202
1158
 
1203
-
1204
1159
 
1205
1160
 
1206
1161
 
@@ -1212,7 +1167,7 @@ is registered AFTER the event has been emitted.
1212
1167
 
1213
1168
 
1214
1169
 
1215
- <h4 class="name" id=".emitStaticId"><span class="type-signature">(static) </span>emitStaticId<span class="signature">(event)</span><span class="type-signature"></span></h4>
1170
+ <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(eventName, &hellip;data)</span><span class="type-signature"> &rarr; {Array.&lt;any>}</span></h4>
1216
1171
 
1217
1172
 
1218
1173
 
@@ -1220,7 +1175,7 @@ is registered AFTER the event has been emitted.
1220
1175
 
1221
1176
 
1222
1177
  <div class="description">
1223
- Require an id to emit.
1178
+ Emit an event by name.
1224
1179
  </div>
1225
1180
 
1226
1181
 
@@ -1244,6 +1199,8 @@ is registered AFTER the event has been emitted.
1244
1199
  <th>Type</th>
1245
1200
 
1246
1201
 
1202
+ <th>Attributes</th>
1203
+
1247
1204
 
1248
1205
 
1249
1206
 
@@ -1256,7 +1213,7 @@ is registered AFTER the event has been emitted.
1256
1213
 
1257
1214
  <tr>
1258
1215
 
1259
- <td class="name"><code>event</code></td>
1216
+ <td class="name"><code>eventName</code></td>
1260
1217
 
1261
1218
 
1262
1219
  <td class="type">
@@ -1264,169 +1221,53 @@ is registered AFTER the event has been emitted.
1264
1221
  </td>
1265
1222
 
1266
1223
 
1224
+ <td class="attributes">
1225
+
1267
1226
 
1268
-
1269
-
1270
- <td class="description last"></td>
1271
- </tr>
1272
-
1273
-
1274
- </tbody>
1275
- </table>
1276
-
1277
-
1278
-
1279
-
1280
-
1281
-
1282
- <dl class="details">
1283
-
1284
-
1285
-
1286
-
1287
-
1288
-
1289
-
1290
-
1291
-
1292
-
1293
-
1294
-
1295
-
1296
-
1297
-
1298
-
1299
-
1300
-
1301
-
1302
-
1303
-
1304
-
1305
-
1306
-
1307
-
1308
-
1309
- <dt class="tag-source">Source:</dt>
1310
- <dd class="tag-source"><ul class="dummy"><li>
1311
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line516">line 516</a>
1312
- </li></ul></dd>
1313
-
1314
-
1315
-
1316
-
1317
-
1318
-
1319
-
1320
- </dl>
1321
-
1322
-
1323
-
1324
-
1325
-
1326
-
1327
-
1328
-
1329
-
1330
-
1331
-
1332
-
1333
-
1334
-
1335
-
1336
-
1337
-
1227
+
1338
1228
 
1339
-
1229
+
1230
+ </td>
1340
1231
 
1341
1232
 
1342
-
1343
-
1344
-
1345
- <h4 class="name" id=".emitStaticId"><span class="type-signature">(static) </span>emitStaticId<span class="signature">(event, id)</span><span class="type-signature"> &rarr; {*}</span></h4>
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
- <div class="description">
1353
- Emit an event that will fire on listeners even when the listener
1354
- is registered AFTER the event has been emitted.
1355
- </div>
1356
-
1357
-
1358
-
1359
-
1360
-
1361
-
1362
-
1363
-
1364
-
1365
- <h5>Parameters:</h5>
1366
-
1367
-
1368
- <table class="params">
1369
- <thead>
1370
- <tr>
1371
-
1372
- <th>Name</th>
1373
-
1374
-
1375
- <th>Type</th>
1376
-
1377
-
1378
-
1379
-
1233
+
1380
1234
 
1381
- <th class="last">Description</th>
1382
- </tr>
1383
- </thead>
1235
+ <td class="description last">The name of the event to emit.</td>
1236
+ </tr>
1384
1237
 
1385
- <tbody>
1386
1238
 
1387
1239
 
1388
1240
  <tr>
1389
1241
 
1390
- <td class="name"><code>event</code></td>
1242
+ <td class="name"><code>data</code></td>
1391
1243
 
1392
1244
 
1393
1245
  <td class="type">
1394
1246
 
1395
1247
 
1396
- <span class="param-type">String</span>
1248
+ <span class="param-type">any</span>
1397
1249
 
1398
1250
 
1399
1251
 
1400
1252
  </td>
1401
1253
 
1402
1254
 
1403
-
1404
-
1405
-
1406
- <td class="description last">The event to emit.</td>
1407
- </tr>
1408
-
1409
-
1410
-
1411
- <tr>
1412
-
1413
- <td class="name"><code>id</code></td>
1414
-
1415
-
1416
- <td class="type">
1417
-
1255
+ <td class="attributes">
1418
1256
 
1419
- <span class="param-type">String</span>
1420
-
1421
1257
 
1422
-
1423
- </td>
1258
+
1424
1259
 
1260
+
1261
+ &lt;repeatable><br>
1262
+
1263
+ </td>
1425
1264
 
1426
1265
 
1427
1266
 
1428
1267
 
1429
- <td class="description last">The id of the event to emit.</td>
1268
+ <td class="description last">The arguments to send to any listening methods.
1269
+ If you are sending multiple arguments, separate them with a comma so
1270
+ that they are received by the function as separate arguments.</td>
1430
1271
  </tr>
1431
1272
 
1432
1273
 
@@ -1467,7 +1308,7 @@ is registered AFTER the event has been emitted.
1467
1308
 
1468
1309
  <dt class="tag-source">Source:</dt>
1469
1310
  <dd class="tag-source"><ul class="dummy"><li>
1470
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line526">line 526</a>
1311
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line307">line 307</a>
1471
1312
  </li></ul></dd>
1472
1313
 
1473
1314
 
@@ -1490,9 +1331,15 @@ is registered AFTER the event has been emitted.
1490
1331
 
1491
1332
 
1492
1333
 
1334
+
1335
+
1493
1336
  <h5>Returns:</h5>
1494
1337
 
1495
1338
 
1339
+ <div class="param-desc">
1340
+ An array of all return values from all the listeners for the event.
1341
+ </div>
1342
+
1496
1343
 
1497
1344
 
1498
1345
  <dl>
@@ -1501,7 +1348,7 @@ is registered AFTER the event has been emitted.
1501
1348
  </dt>
1502
1349
  <dd>
1503
1350
 
1504
- <span class="param-type">*</span>
1351
+ <span class="param-type">Array.&lt;any></span>
1505
1352
 
1506
1353
 
1507
1354
  </dd>
@@ -1512,6 +1359,39 @@ is registered AFTER the event has been emitted.
1512
1359
 
1513
1360
 
1514
1361
 
1362
+ <h5>Examples</h5>
1363
+
1364
+ <pre class="prettyprint"><code>#Emit an Event
1365
+ // Emit the event named "hello"
1366
+ myEntity.emit('hello');</code></pre>
1367
+
1368
+ <pre class="prettyprint"><code>#Emit an Event With Data Object
1369
+ // Emit the event named "hello"
1370
+ myEntity.emit('hello', {moo: true});</code></pre>
1371
+
1372
+ <pre class="prettyprint"><code>#Emit an Event With Multiple Data Values
1373
+ // Emit the event named "hello"
1374
+ myEntity.emit('hello', {moo: true}, 'someString');</code></pre>
1375
+
1376
+ <pre class="prettyprint"><code>#Listen for Event Data
1377
+ // Set a listener to listen for the data (multiple values emitted
1378
+ // from an event are passed as function arguments)
1379
+ myEntity.on('hello', function (arg1, arg2) {
1380
+ console.log("Arguments:", arg1, arg2);
1381
+ return "foo";
1382
+ }
1383
+
1384
+ // Emit the event named "hello"
1385
+ // The result is returned as an array of all return values
1386
+ // from all the listeners for the event
1387
+ const result = myEntity.emit('hello', 'data1', 'data2');
1388
+ console.log("Result:", result);
1389
+
1390
+ // The console output is:
1391
+ // Arguments: data1 data2
1392
+ // Result: ["foo"]</code></pre>
1393
+
1394
+
1515
1395
 
1516
1396
 
1517
1397
 
@@ -1519,7 +1399,7 @@ is registered AFTER the event has been emitted.
1519
1399
 
1520
1400
 
1521
1401
 
1522
- <h4 class="name" id=".emitStaticId"><span class="type-signature">(static) </span>emitStaticId<span class="signature">(event, id, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
1402
+ <h4 class="name" id="emitId"><span class="type-signature"></span>emitId<span class="signature">(eventName, id, &hellip;data)</span><span class="type-signature"> &rarr; {Array.&lt;any>}</span></h4>
1523
1403
 
1524
1404
 
1525
1405
 
@@ -1527,8 +1407,7 @@ is registered AFTER the event has been emitted.
1527
1407
 
1528
1408
 
1529
1409
  <div class="description">
1530
- Emit an event that will fire on listeners even when the listener
1531
- is registered AFTER the event has been emitted.
1410
+ Emits an event by name and id.
1532
1411
  </div>
1533
1412
 
1534
1413
 
@@ -1566,47 +1445,11 @@ is registered AFTER the event has been emitted.
1566
1445
 
1567
1446
  <tr>
1568
1447
 
1569
- <td class="name"><code>event</code></td>
1570
-
1571
-
1572
- <td class="type">
1573
-
1574
-
1575
- <span class="param-type">String</span>
1576
-
1577
-
1578
-
1579
- </td>
1580
-
1581
-
1582
- <td class="attributes">
1583
-
1584
-
1585
-
1586
-
1587
-
1588
- </td>
1589
-
1590
-
1591
-
1592
-
1593
- <td class="description last">The event to emit.</td>
1594
- </tr>
1595
-
1596
-
1597
-
1598
- <tr>
1599
-
1600
- <td class="name"><code>id</code></td>
1448
+ <td class="name"><code>eventName</code></td>
1601
1449
 
1602
1450
 
1603
1451
  <td class="type">
1604
1452
 
1605
-
1606
- <span class="param-type">String</span>
1607
-
1608
-
1609
-
1610
1453
  </td>
1611
1454
 
1612
1455
 
@@ -1615,1074 +1458,74 @@ is registered AFTER the event has been emitted.
1615
1458
 
1616
1459
 
1617
1460
 
1618
-
1619
- </td>
1620
-
1621
-
1622
-
1623
-
1624
- <td class="description last">The id of the event to emit.</td>
1625
- </tr>
1626
-
1627
-
1628
-
1629
- <tr>
1630
-
1631
- <td class="name"><code>data</code></td>
1632
-
1633
-
1634
- <td class="type">
1635
-
1636
-
1637
- <span class="param-type">*</span>
1638
-
1639
-
1640
-
1641
- </td>
1642
-
1643
-
1644
- <td class="attributes">
1645
-
1646
- &lt;optional><br>
1647
-
1648
-
1649
-
1650
-
1651
-
1652
- </td>
1653
-
1654
-
1655
-
1656
-
1657
- <td class="description last">The data to emit with the event.</td>
1658
- </tr>
1659
-
1660
-
1661
- </tbody>
1662
- </table>
1663
-
1664
-
1665
-
1666
-
1667
-
1668
-
1669
- <dl class="details">
1670
-
1671
-
1672
-
1673
-
1674
-
1675
-
1676
-
1677
-
1678
-
1679
-
1680
-
1681
-
1682
-
1683
-
1684
-
1685
-
1686
-
1687
-
1688
-
1689
-
1690
-
1691
-
1692
-
1693
-
1694
-
1695
-
1696
- <dt class="tag-source">Source:</dt>
1697
- <dd class="tag-source"><ul class="dummy"><li>
1698
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line539">line 539</a>
1699
- </li></ul></dd>
1700
-
1701
-
1702
-
1703
-
1704
-
1705
-
1706
-
1707
- </dl>
1708
-
1709
-
1710
-
1711
-
1712
-
1713
-
1714
-
1715
-
1716
-
1717
-
1718
-
1719
-
1720
-
1721
- <h5>Returns:</h5>
1722
-
1723
-
1724
-
1725
-
1726
- <dl>
1727
- <dt>
1728
- Type
1729
- </dt>
1730
- <dd>
1731
-
1732
- <span class="param-type">*</span>
1733
-
1734
-
1735
- </dd>
1736
- </dl>
1737
-
1738
-
1739
-
1740
-
1741
-
1742
-
1743
-
1744
-
1745
-
1746
-
1747
-
1748
-
1749
-
1750
- <h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, id)</span><span class="type-signature"></span></h4>
1751
-
1752
-
1753
-
1754
-
1755
-
1756
-
1757
- <div class="description">
1758
- Cancels all listeners for an event based on the passed event name and id.
1759
- </div>
1760
-
1761
-
1762
-
1763
-
1764
-
1765
-
1766
-
1767
-
1768
-
1769
- <h5>Parameters:</h5>
1770
-
1771
-
1772
- <table class="params">
1773
- <thead>
1774
- <tr>
1775
-
1776
- <th>Name</th>
1777
-
1778
-
1779
- <th>Type</th>
1780
-
1781
-
1782
-
1783
-
1784
-
1785
- <th class="last">Description</th>
1786
- </tr>
1787
- </thead>
1788
-
1789
- <tbody>
1790
-
1791
-
1792
- <tr>
1793
-
1794
- <td class="name"><code>event</code></td>
1795
-
1796
-
1797
- <td class="type">
1798
-
1799
-
1800
- <span class="param-type">String</span>
1801
-
1802
-
1803
-
1804
- </td>
1805
-
1806
-
1807
-
1808
-
1809
-
1810
- <td class="description last">The event name to cancel listeners for.</td>
1811
- </tr>
1812
-
1813
-
1814
-
1815
- <tr>
1816
-
1817
- <td class="name"><code>id</code></td>
1818
-
1819
-
1820
- <td class="type">
1821
-
1822
-
1823
- <span class="param-type">*</span>
1824
-
1825
-
1826
-
1827
- </td>
1828
-
1829
-
1830
-
1831
-
1832
-
1833
- <td class="description last">The ID to cancel all listeners for.</td>
1834
- </tr>
1835
-
1836
-
1837
- </tbody>
1838
- </table>
1839
-
1840
-
1841
-
1842
-
1843
-
1844
-
1845
- <dl class="details">
1846
-
1847
-
1848
-
1849
-
1850
-
1851
-
1852
-
1853
-
1854
-
1855
-
1856
-
1857
-
1858
-
1859
-
1860
-
1861
-
1862
-
1863
-
1864
-
1865
-
1866
-
1867
-
1868
-
1869
-
1870
-
1871
-
1872
- <dt class="tag-source">Source:</dt>
1873
- <dd class="tag-source"><ul class="dummy"><li>
1874
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line279">line 279</a>
1875
- </li></ul></dd>
1876
-
1877
-
1878
-
1879
-
1880
-
1881
-
1882
-
1883
- </dl>
1884
-
1885
-
1886
-
1887
-
1888
-
1889
-
1890
-
1891
-
1892
-
1893
-
1894
-
1895
-
1896
-
1897
-
1898
-
1899
-
1900
-
1901
-
1902
-
1903
-
1904
-
1905
-
1906
-
1907
-
1908
- <h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, id, listener)</span><span class="type-signature"></span></h4>
1909
-
1910
-
1911
-
1912
-
1913
-
1914
-
1915
- <div class="description">
1916
- Cancels an event listener based on an event name, id and listener function.
1917
- </div>
1918
-
1919
-
1920
-
1921
-
1922
-
1923
-
1924
-
1925
-
1926
-
1927
- <h5>Parameters:</h5>
1928
-
1929
-
1930
- <table class="params">
1931
- <thead>
1932
- <tr>
1933
-
1934
- <th>Name</th>
1935
-
1936
-
1937
- <th>Type</th>
1938
-
1939
-
1940
-
1941
-
1942
-
1943
- <th class="last">Description</th>
1944
- </tr>
1945
- </thead>
1946
-
1947
- <tbody>
1948
-
1949
-
1950
- <tr>
1951
-
1952
- <td class="name"><code>event</code></td>
1953
-
1954
-
1955
- <td class="type">
1956
-
1957
-
1958
- <span class="param-type">String</span>
1959
-
1960
-
1961
-
1962
- </td>
1963
-
1964
-
1965
-
1966
-
1967
-
1968
- <td class="description last">The event to cancel listener for.</td>
1969
- </tr>
1970
-
1971
-
1972
-
1973
- <tr>
1974
-
1975
- <td class="name"><code>id</code></td>
1976
-
1977
-
1978
- <td class="type">
1979
-
1980
-
1981
- <span class="param-type">String</span>
1982
-
1983
-
1984
-
1985
- </td>
1986
-
1987
-
1988
-
1989
-
1990
-
1991
- <td class="description last">The ID of the event to cancel listening for.</td>
1992
- </tr>
1993
-
1994
-
1995
-
1996
- <tr>
1997
-
1998
- <td class="name"><code>listener</code></td>
1999
-
2000
-
2001
- <td class="type">
2002
-
2003
-
2004
- <span class="param-type">function</span>
2005
-
2006
-
2007
-
2008
- </td>
2009
-
2010
-
2011
-
2012
-
2013
-
2014
- <td class="description last">The event listener function used in the on()
2015
- or once() call to cancel.</td>
2016
- </tr>
2017
-
2018
-
2019
- </tbody>
2020
- </table>
2021
-
2022
-
2023
-
2024
-
2025
-
2026
-
2027
- <dl class="details">
2028
-
2029
-
2030
-
2031
-
2032
-
2033
-
2034
-
2035
-
2036
-
2037
-
2038
-
2039
-
2040
-
2041
-
2042
-
2043
-
2044
-
2045
-
2046
-
2047
-
2048
-
2049
-
2050
-
2051
-
2052
-
2053
-
2054
- <dt class="tag-source">Source:</dt>
2055
- <dd class="tag-source"><ul class="dummy"><li>
2056
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line250">line 250</a>
2057
- </li></ul></dd>
2058
-
2059
-
2060
-
2061
-
2062
-
2063
-
2064
-
2065
- </dl>
2066
-
2067
-
2068
-
2069
-
2070
-
2071
-
2072
-
2073
-
2074
-
2075
-
2076
-
2077
-
2078
-
2079
-
2080
-
2081
-
2082
-
2083
-
2084
-
2085
-
2086
-
2087
-
2088
-
2089
-
2090
- <h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, listener)</span><span class="type-signature"> &rarr; {*}</span></h4>
2091
-
2092
-
2093
-
2094
-
2095
-
2096
-
2097
- <div class="description">
2098
- Cancels the event listener for the passed event and listener function.
2099
- </div>
2100
-
2101
-
2102
-
2103
-
2104
-
2105
-
2106
-
2107
-
2108
-
2109
- <h5>Parameters:</h5>
2110
-
2111
-
2112
- <table class="params">
2113
- <thead>
2114
- <tr>
2115
-
2116
- <th>Name</th>
2117
-
2118
-
2119
- <th>Type</th>
2120
-
2121
-
2122
-
2123
-
2124
-
2125
- <th class="last">Description</th>
2126
- </tr>
2127
- </thead>
2128
-
2129
- <tbody>
2130
-
2131
-
2132
- <tr>
2133
-
2134
- <td class="name"><code>event</code></td>
2135
-
2136
-
2137
- <td class="type">
2138
-
2139
-
2140
- <span class="param-type">String</span>
2141
-
2142
-
2143
-
2144
- </td>
2145
-
2146
-
2147
-
2148
-
2149
-
2150
- <td class="description last">The event to cancel listener for.</td>
2151
- </tr>
2152
-
2153
-
2154
-
2155
- <tr>
2156
-
2157
- <td class="name"><code>listener</code></td>
2158
-
2159
-
2160
- <td class="type">
2161
-
2162
-
2163
- <span class="param-type">function</span>
2164
-
2165
-
2166
-
2167
- </td>
2168
-
2169
-
2170
-
2171
-
2172
-
2173
- <td class="description last">The event listener function used in the on()
2174
- or once() call to cancel.</td>
2175
- </tr>
2176
-
2177
-
2178
- </tbody>
2179
- </table>
2180
-
2181
-
2182
-
2183
-
2184
-
2185
-
2186
- <dl class="details">
2187
-
2188
-
2189
-
2190
-
2191
-
2192
-
2193
-
2194
-
2195
-
2196
-
2197
-
2198
-
2199
-
2200
-
2201
-
2202
-
2203
-
2204
-
2205
-
2206
-
2207
-
2208
-
2209
-
2210
-
2211
-
2212
-
2213
- <dt class="tag-source">Source:</dt>
2214
- <dd class="tag-source"><ul class="dummy"><li>
2215
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line211">line 211</a>
2216
- </li></ul></dd>
2217
-
2218
-
2219
-
2220
-
2221
-
2222
-
2223
-
2224
- </dl>
2225
-
2226
-
2227
-
2228
-
2229
-
2230
-
2231
-
2232
-
2233
-
2234
-
2235
-
2236
-
2237
-
2238
- <h5>Returns:</h5>
2239
-
2240
-
2241
-
2242
-
2243
- <dl>
2244
- <dt>
2245
- Type
2246
- </dt>
2247
- <dd>
2248
-
2249
- <span class="param-type">*</span>
2250
-
2251
-
2252
- </dd>
2253
- </dl>
2254
-
2255
-
2256
-
2257
-
2258
-
2259
-
2260
-
2261
-
2262
-
2263
-
2264
-
2265
-
2266
-
2267
- <h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event)</span><span class="type-signature"> &rarr; {*}</span></h4>
2268
-
2269
-
2270
-
2271
-
2272
-
2273
-
2274
- <div class="description">
2275
- Cancels all event listeners for the passed event.
2276
- </div>
2277
-
2278
-
2279
-
2280
-
2281
-
2282
-
2283
-
2284
-
2285
-
2286
- <h5>Parameters:</h5>
2287
-
2288
-
2289
- <table class="params">
2290
- <thead>
2291
- <tr>
2292
-
2293
- <th>Name</th>
2294
-
2295
-
2296
- <th>Type</th>
2297
-
2298
-
2299
-
2300
-
2301
-
2302
- <th class="last">Description</th>
2303
- </tr>
2304
- </thead>
2305
-
2306
- <tbody>
2307
-
2308
-
2309
- <tr>
2310
-
2311
- <td class="name"><code>event</code></td>
2312
-
2313
-
2314
- <td class="type">
2315
-
2316
-
2317
- <span class="param-type">String</span>
2318
-
2319
-
2320
-
2321
- </td>
2322
-
2323
-
2324
-
2325
-
2326
-
2327
- <td class="description last">The name of the event.</td>
2328
- </tr>
2329
-
2330
-
2331
- </tbody>
2332
- </table>
2333
-
2334
-
2335
-
2336
-
2337
-
2338
-
2339
- <dl class="details">
2340
-
2341
-
2342
-
2343
-
2344
-
2345
-
2346
-
2347
-
2348
-
2349
-
2350
-
2351
-
2352
-
2353
-
2354
-
2355
-
2356
-
2357
-
2358
-
2359
-
2360
-
2361
-
2362
-
2363
-
2364
-
2365
-
2366
- <dt class="tag-source">Source:</dt>
2367
- <dd class="tag-source"><ul class="dummy"><li>
2368
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line187">line 187</a>
2369
- </li></ul></dd>
2370
-
2371
-
2372
-
2373
-
2374
-
2375
-
2376
-
2377
- </dl>
2378
-
2379
-
2380
-
2381
-
2382
-
2383
-
2384
-
2385
-
2386
-
2387
-
2388
-
2389
-
2390
-
2391
- <h5>Returns:</h5>
2392
-
2393
-
2394
-
2395
-
2396
- <dl>
2397
- <dt>
2398
- Type
2399
- </dt>
2400
- <dd>
2401
-
2402
- <span class="param-type">*</span>
2403
-
2404
-
2405
- </dd>
2406
- </dl>
2407
-
2408
-
2409
-
2410
-
2411
-
2412
-
2413
-
2414
-
2415
-
2416
-
2417
-
2418
-
2419
-
2420
- <h4 class="name" id=".on"><span class="type-signature">(static) </span>on<span class="signature">(event, id, listener)</span><span class="type-signature"></span></h4>
2421
-
2422
-
2423
-
2424
-
2425
-
2426
-
2427
- <div class="description">
2428
- Attach an event listener to the passed event only if the passed
2429
- id matches the document id for the event being fired.
2430
- </div>
2431
-
2432
-
2433
-
2434
-
2435
-
2436
-
2437
-
2438
-
2439
-
2440
- <h5>Parameters:</h5>
2441
-
2442
-
2443
- <table class="params">
2444
- <thead>
2445
- <tr>
2446
-
2447
- <th>Name</th>
2448
-
2449
-
2450
- <th>Type</th>
2451
-
2452
-
2453
-
2454
-
2455
-
2456
- <th class="last">Description</th>
2457
- </tr>
2458
- </thead>
2459
-
2460
- <tbody>
2461
-
2462
-
2463
- <tr>
2464
-
2465
- <td class="name"><code>event</code></td>
2466
-
2467
-
2468
- <td class="type">
2469
-
2470
-
2471
- <span class="param-type">String</span>
2472
-
2473
-
2474
-
2475
- </td>
2476
-
2477
-
2478
-
2479
-
2480
-
2481
- <td class="description last">The name of the event to listen for.</td>
2482
- </tr>
2483
-
2484
-
2485
-
2486
- <tr>
2487
-
2488
- <td class="name"><code>id</code></td>
2489
-
2490
-
2491
- <td class="type">
2492
-
2493
-
2494
- <span class="param-type">*</span>
2495
-
2496
-
2497
-
2498
- </td>
2499
-
2500
-
2501
-
2502
-
2503
-
2504
- <td class="description last">The document id to match against.</td>
2505
- </tr>
2506
-
2507
-
2508
-
2509
- <tr>
2510
-
2511
- <td class="name"><code>listener</code></td>
2512
-
2513
-
2514
- <td class="type">
2515
-
2516
-
2517
- <span class="param-type">function</span>
2518
-
2519
-
2520
-
2521
- </td>
2522
-
2523
-
2524
-
2525
-
2526
-
2527
- <td class="description last">The method to call when the event is fired.</td>
2528
- </tr>
2529
-
2530
-
2531
- </tbody>
2532
- </table>
2533
-
2534
-
2535
-
2536
-
2537
-
2538
-
2539
- <dl class="details">
2540
-
2541
-
2542
-
2543
-
2544
-
2545
-
2546
-
2547
-
2548
-
2549
-
2550
-
2551
-
2552
-
2553
-
2554
-
2555
-
2556
-
2557
-
2558
-
2559
-
2560
-
2561
-
2562
-
2563
-
2564
-
2565
-
2566
- <dt class="tag-source">Source:</dt>
2567
- <dd class="tag-source"><ul class="dummy"><li>
2568
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line84">line 84</a>
2569
- </li></ul></dd>
2570
-
2571
-
2572
-
2573
-
2574
-
2575
-
2576
-
2577
- </dl>
2578
-
2579
-
2580
-
2581
-
2582
-
2583
-
2584
-
2585
-
2586
-
2587
-
2588
-
2589
-
2590
-
2591
-
2592
-
2593
-
2594
-
2595
-
2596
-
2597
-
2598
-
2599
-
2600
-
2601
-
2602
- <h4 class="name" id=".on"><span class="type-signature">(static) </span>on<span class="signature">(event, listener)</span><span class="type-signature"></span></h4>
2603
-
2604
-
2605
-
2606
-
2607
-
2608
-
2609
- <div class="description">
2610
- Attach an event listener to the passed event.
2611
- </div>
2612
-
2613
-
2614
-
2615
-
2616
-
2617
-
2618
-
2619
-
2620
-
2621
- <h5>Parameters:</h5>
2622
-
2623
-
2624
- <table class="params">
2625
- <thead>
2626
- <tr>
2627
-
2628
- <th>Name</th>
2629
-
2630
-
2631
- <th>Type</th>
2632
-
2633
-
1461
+
1462
+ </td>
1463
+
2634
1464
 
2635
-
1465
+
2636
1466
 
2637
- <th class="last">Description</th>
2638
- </tr>
2639
- </thead>
1467
+ <td class="description last">The name of the event to emit.</td>
1468
+ </tr>
2640
1469
 
2641
- <tbody>
2642
1470
 
2643
1471
 
2644
1472
  <tr>
2645
1473
 
2646
- <td class="name"><code>event</code></td>
1474
+ <td class="name"><code>id</code></td>
2647
1475
 
2648
1476
 
2649
1477
  <td class="type">
2650
1478
 
2651
-
2652
- <span class="param-type">String</span>
2653
-
1479
+ </td>
2654
1480
 
2655
1481
 
2656
- </td>
1482
+ <td class="attributes">
1483
+
1484
+
1485
+
2657
1486
 
1487
+
1488
+ </td>
2658
1489
 
2659
1490
 
2660
1491
 
2661
1492
 
2662
- <td class="description last">The name of the event to listen for.</td>
1493
+ <td class="description last">The id of the event to emit.</td>
2663
1494
  </tr>
2664
1495
 
2665
1496
 
2666
1497
 
2667
1498
  <tr>
2668
1499
 
2669
- <td class="name"><code>listener</code></td>
1500
+ <td class="name"><code>data</code></td>
2670
1501
 
2671
1502
 
2672
1503
  <td class="type">
2673
1504
 
2674
1505
 
2675
- <span class="param-type">function</span>
1506
+ <span class="param-type">any</span>
2676
1507
 
2677
1508
 
2678
1509
 
2679
1510
  </td>
2680
1511
 
2681
1512
 
1513
+ <td class="attributes">
1514
+
1515
+
1516
+
1517
+
1518
+
1519
+ &lt;repeatable><br>
1520
+
1521
+ </td>
1522
+
2682
1523
 
2683
1524
 
2684
1525
 
2685
- <td class="description last">The method to call when the event is fired.</td>
1526
+ <td class="description last">The arguments to send to any listening methods.
1527
+ If you are sending multiple arguments, separate them with a comma so
1528
+ that they are received by the function as separate arguments.</td>
2686
1529
  </tr>
2687
1530
 
2688
1531
 
@@ -2723,7 +1566,7 @@ id matches the document id for the event being fired.
2723
1566
 
2724
1567
  <dt class="tag-source">Source:</dt>
2725
1568
  <dd class="tag-source"><ul class="dummy"><li>
2726
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line73">line 73</a>
1569
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line320">line 320</a>
2727
1570
  </li></ul></dd>
2728
1571
 
2729
1572
 
@@ -2748,6 +1591,30 @@ id matches the document id for the event being fired.
2748
1591
 
2749
1592
 
2750
1593
 
1594
+ <h5>Returns:</h5>
1595
+
1596
+
1597
+ <div class="param-desc">
1598
+ An array of all return values from all the listeners for the event.
1599
+ </div>
1600
+
1601
+
1602
+
1603
+ <dl>
1604
+ <dt>
1605
+ Type
1606
+ </dt>
1607
+ <dd>
1608
+
1609
+ <span class="param-type">Array.&lt;any></span>
1610
+
1611
+
1612
+ </dd>
1613
+ </dl>
1614
+
1615
+
1616
+
1617
+
2751
1618
 
2752
1619
 
2753
1620
 
@@ -2757,7 +1624,7 @@ id matches the document id for the event being fired.
2757
1624
 
2758
1625
 
2759
1626
 
2760
- <h4 class="name" id=".once"><span class="type-signature">(static) </span>once<span class="signature">(event, id, listener)</span><span class="type-signature"></span></h4>
1627
+ <h4 class="name" id="offAny"><span class="type-signature"></span>offAny<span class="signature">()</span><span class="type-signature"></span></h4>
2761
1628
 
2762
1629
 
2763
1630
 
@@ -2765,8 +1632,8 @@ id matches the document id for the event being fired.
2765
1632
 
2766
1633
 
2767
1634
  <div class="description">
2768
- Attach an event listener to the passed event only if the passed
2769
- id matches the document id for the event being fired.
1635
+ Removes an event listener that listens for any and all events
1636
+ emitted.
2770
1637
  </div>
2771
1638
 
2772
1639
 
@@ -2777,99 +1644,93 @@ id matches the document id for the event being fired.
2777
1644
 
2778
1645
 
2779
1646
 
2780
- <h5>Parameters:</h5>
1647
+
1648
+
1649
+
1650
+
1651
+ <dl class="details">
1652
+
2781
1653
 
2782
1654
 
2783
- <table class="params">
2784
- <thead>
2785
- <tr>
2786
-
2787
- <th>Name</th>
2788
-
1655
+
2789
1656
 
2790
- <th>Type</th>
1657
+
2791
1658
 
2792
-
1659
+
2793
1660
 
2794
-
1661
+
2795
1662
 
2796
- <th class="last">Description</th>
2797
- </tr>
2798
- </thead>
1663
+
2799
1664
 
2800
- <tbody>
2801
1665
 
2802
1666
 
2803
- <tr>
2804
-
2805
- <td class="name"><code>event</code></td>
2806
-
1667
+
2807
1668
 
2808
- <td class="type">
2809
-
2810
-
2811
- <span class="param-type">String</span>
1669
+
2812
1670
 
1671
+
2813
1672
 
2814
-
2815
- </td>
1673
+
2816
1674
 
2817
-
1675
+
2818
1676
 
2819
-
1677
+
1678
+ <dt class="tag-source">Source:</dt>
1679
+ <dd class="tag-source"><ul class="dummy"><li>
1680
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line153">line 153</a>
1681
+ </li></ul></dd>
1682
+
2820
1683
 
2821
- <td class="description last">The name of the event to listen for.</td>
2822
- </tr>
1684
+
2823
1685
 
2824
1686
 
2825
1687
 
2826
- <tr>
2827
-
2828
- <td class="name"><code>id</code></td>
2829
-
1688
+
1689
+ </dl>
1690
+
1691
+
1692
+
2830
1693
 
2831
- <td class="type">
2832
-
2833
-
2834
- <span class="param-type">*</span>
2835
1694
 
2836
1695
 
2837
-
2838
- </td>
2839
1696
 
2840
-
2841
1697
 
2842
-
2843
1698
 
2844
- <td class="description last">The document id to match against.</td>
2845
- </tr>
2846
1699
 
2847
-
2848
1700
 
2849
- <tr>
2850
-
2851
- <td class="name"><code>listener</code></td>
2852
-
2853
1701
 
2854
- <td class="type">
2855
-
2856
-
2857
- <span class="param-type">function</span>
2858
1702
 
2859
1703
 
2860
-
2861
- </td>
2862
1704
 
2863
-
2864
1705
 
1706
+
1707
+
1708
+
1709
+
1710
+
2865
1711
 
2866
1712
 
2867
- <td class="description last">The method to call when the event is fired.</td>
2868
- </tr>
1713
+
2869
1714
 
2870
1715
 
2871
- </tbody>
2872
- </table>
1716
+ <h4 class="name" id="onAny"><span class="type-signature"></span>onAny<span class="signature">()</span><span class="type-signature"></span></h4>
1717
+
1718
+
1719
+
1720
+
1721
+
1722
+
1723
+ <div class="description">
1724
+ Creates an event listener that listens for any and all events
1725
+ emitted.
1726
+ </div>
1727
+
1728
+
1729
+
1730
+
1731
+
1732
+
1733
+
2873
1734
 
2874
1735
 
2875
1736
 
@@ -2905,7 +1766,7 @@ id matches the document id for the event being fired.
2905
1766
 
2906
1767
  <dt class="tag-source">Source:</dt>
2907
1768
  <dd class="tag-source"><ul class="dummy"><li>
2908
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line162">line 162</a>
1769
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line124">line 124</a>
2909
1770
  </li></ul></dd>
2910
1771
 
2911
1772
 
@@ -2933,13 +1794,15 @@ id matches the document id for the event being fired.
2933
1794
 
2934
1795
 
2935
1796
 
1797
+
1798
+
2936
1799
 
2937
1800
 
2938
1801
 
2939
1802
 
2940
1803
 
2941
1804
 
2942
- <h4 class="name" id=".once"><span class="type-signature">(static) </span>once<span class="signature">(event, listener)</span><span class="type-signature"></span></h4>
1805
+ <h4 class="name" id="rpc"><span class="type-signature"></span>rpc<span class="signature">(eventName, &hellip;data)</span><span class="type-signature"> &rarr; {number}</span></h4>
2943
1806
 
2944
1807
 
2945
1808
 
@@ -2947,7 +1810,11 @@ id matches the document id for the event being fired.
2947
1810
 
2948
1811
 
2949
1812
  <div class="description">
2950
- Attach an event listener to the passed event which will only fire once.
1813
+ Call an event listener by name. The `rpc()` function differs from `emit()` in
1814
+ that it will only call and return data from the first event listener for the
1815
+ event rather than all event listeners. If you have more than one event listener
1816
+ assigned to the event, all others except the first will be ignored and will
1817
+ not receive the event.
2951
1818
  </div>
2952
1819
 
2953
1820
 
@@ -2971,6 +1838,8 @@ id matches the document id for the event being fired.
2971
1838
  <th>Type</th>
2972
1839
 
2973
1840
 
1841
+ <th>Attributes</th>
1842
+
2974
1843
 
2975
1844
 
2976
1845
 
@@ -2983,46 +1852,61 @@ id matches the document id for the event being fired.
2983
1852
 
2984
1853
  <tr>
2985
1854
 
2986
- <td class="name"><code>event</code></td>
1855
+ <td class="name"><code>eventName</code></td>
2987
1856
 
2988
1857
 
2989
1858
  <td class="type">
2990
1859
 
2991
-
2992
- <span class="param-type">String</span>
2993
-
1860
+ </td>
2994
1861
 
2995
1862
 
2996
- </td>
1863
+ <td class="attributes">
1864
+
2997
1865
 
1866
+
1867
+
1868
+
1869
+ </td>
2998
1870
 
2999
1871
 
3000
1872
 
3001
1873
 
3002
- <td class="description last">The name of the event to listen for.</td>
1874
+ <td class="description last">The name of the event to call the listener for.</td>
3003
1875
  </tr>
3004
1876
 
3005
1877
 
3006
1878
 
3007
1879
  <tr>
3008
1880
 
3009
- <td class="name"><code>listener</code></td>
1881
+ <td class="name"><code>data</code></td>
3010
1882
 
3011
1883
 
3012
1884
  <td class="type">
3013
1885
 
3014
1886
 
3015
- <span class="param-type">function</span>
1887
+ <span class="param-type">any</span>
3016
1888
 
3017
1889
 
3018
1890
 
3019
1891
  </td>
3020
1892
 
3021
1893
 
1894
+ <td class="attributes">
1895
+
1896
+
1897
+
1898
+
1899
+
1900
+ &lt;repeatable><br>
1901
+
1902
+ </td>
1903
+
3022
1904
 
3023
1905
 
3024
1906
 
3025
- <td class="description last">The method to call when the event is fired.</td>
1907
+ <td class="description last">The arguments to send to the listening method.
1908
+ If you are sending multiple arguments, separate them with a comma so
1909
+ that they are received by the function as separate arguments.</td>
3026
1910
  </tr>
3027
1911
 
3028
1912
 
@@ -3063,7 +1947,7 @@ id matches the document id for the event being fired.
3063
1947
 
3064
1948
  <dt class="tag-source">Source:</dt>
3065
1949
  <dd class="tag-source"><ul class="dummy"><li>
3066
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line141">line 141</a>
1950
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line244">line 244</a>
3067
1951
  </li></ul></dd>
3068
1952
 
3069
1953
 
@@ -3088,6 +1972,57 @@ id matches the document id for the event being fired.
3088
1972
 
3089
1973
 
3090
1974
 
1975
+ <h5>Returns:</h5>
1976
+
1977
+
1978
+
1979
+
1980
+ <dl>
1981
+ <dt>
1982
+ Type
1983
+ </dt>
1984
+ <dd>
1985
+
1986
+ <span class="param-type">number</span>
1987
+
1988
+
1989
+ </dd>
1990
+ </dl>
1991
+
1992
+
1993
+
1994
+
1995
+
1996
+
1997
+ <h5>Examples</h5>
1998
+
1999
+ <pre class="prettyprint"><code>#Call the Event Listener
2000
+ // Emit the event named "hello"
2001
+ myEntity.emit('hello');</code></pre>
2002
+
2003
+ <pre class="prettyprint"><code>#Call the Event Listener With Data Object
2004
+ // Emit the event named "hello"
2005
+ myEntity.emit('hello', {moo: true});</code></pre>
2006
+
2007
+ <pre class="prettyprint"><code>#Call the Event Listener With Multiple Data Values
2008
+ // Emit the event named "hello"
2009
+ myEntity.emit('hello', {moo: true}, 'someString');</code></pre>
2010
+
2011
+ <pre class="prettyprint"><code>#Register the Listener for Event Data
2012
+ // Set a listener to listen for the data (multiple values emitted
2013
+ // from an event are passed as function arguments)
2014
+ myEntity.on('hello', function (arg1, arg2) {
2015
+ console.log("Arguments:", arg1, arg2);
2016
+ return "foo";
2017
+ }
2018
+
2019
+ // Emit the event named "hello"
2020
+ const result = myEntity.emit('hello', 'data1', 'data2');
2021
+ console.log("Result:", result);
2022
+
2023
+ // The console output is:
2024
+ // Arguments: data1 data2
2025
+ // Result: "foo"</code></pre>
3091
2026
 
3092
2027
 
3093
2028
 
@@ -3097,7 +2032,7 @@ id matches the document id for the event being fired.
3097
2032
 
3098
2033
 
3099
2034
 
3100
- <h4 class="name" id=".willEmit"><span class="type-signature">(static) </span>willEmit<span class="signature">(event)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
2035
+ <h4 class="name" id="willEmit"><span class="type-signature"></span>willEmit<span class="signature">(eventName)</span><span class="type-signature"></span></h4>
3101
2036
 
3102
2037
 
3103
2038
 
@@ -3141,16 +2076,11 @@ id matches the document id for the event being fired.
3141
2076
 
3142
2077
  <tr>
3143
2078
 
3144
- <td class="name"><code>event</code></td>
2079
+ <td class="name"><code>eventName</code></td>
3145
2080
 
3146
2081
 
3147
2082
  <td class="type">
3148
2083
 
3149
-
3150
- <span class="param-type">String</span>
3151
-
3152
-
3153
-
3154
2084
  </td>
3155
2085
 
3156
2086
 
@@ -3198,7 +2128,7 @@ id matches the document id for the event being fired.
3198
2128
 
3199
2129
  <dt class="tag-source">Source:</dt>
3200
2130
  <dd class="tag-source"><ul class="dummy"><li>
3201
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line647">line 647</a>
2131
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line451">line 451</a>
3202
2132
  </li></ul></dd>
3203
2133
 
3204
2134
 
@@ -3221,6 +2151,8 @@ id matches the document id for the event being fired.
3221
2151
 
3222
2152
 
3223
2153
 
2154
+
2155
+
3224
2156
  <h5>Returns:</h5>
3225
2157
 
3226
2158
 
@@ -3231,18 +2163,6 @@ the event. False if none are found.
3231
2163
 
3232
2164
 
3233
2165
 
3234
- <dl>
3235
- <dt>
3236
- Type
3237
- </dt>
3238
- <dd>
3239
-
3240
- <span class="param-type">boolean</span>
3241
-
3242
-
3243
- </dd>
3244
- </dl>
3245
-
3246
2166
 
3247
2167
 
3248
2168
 
@@ -3255,7 +2175,7 @@ the event. False if none are found.
3255
2175
 
3256
2176
 
3257
2177
 
3258
- <h4 class="name" id=".willEmitId"><span class="type-signature">(static) </span>willEmitId<span class="signature">(event, id)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
2178
+ <h4 class="name" id="willEmitId"><span class="type-signature"></span>willEmitId<span class="signature">(eventName, id)</span><span class="type-signature"></span></h4>
3259
2179
 
3260
2180
 
3261
2181
 
@@ -3299,16 +2219,11 @@ the event. False if none are found.
3299
2219
 
3300
2220
  <tr>
3301
2221
 
3302
- <td class="name"><code>event</code></td>
2222
+ <td class="name"><code>eventName</code></td>
3303
2223
 
3304
2224
 
3305
2225
  <td class="type">
3306
2226
 
3307
-
3308
- <span class="param-type">String</span>
3309
-
3310
-
3311
-
3312
2227
  </td>
3313
2228
 
3314
2229
 
@@ -3327,11 +2242,6 @@ the event. False if none are found.
3327
2242
 
3328
2243
  <td class="type">
3329
2244
 
3330
-
3331
- <span class="param-type">String</span>
3332
-
3333
-
3334
-
3335
2245
  </td>
3336
2246
 
3337
2247
 
@@ -3379,7 +2289,7 @@ the event. False if none are found.
3379
2289
 
3380
2290
  <dt class="tag-source">Source:</dt>
3381
2291
  <dd class="tag-source"><ul class="dummy"><li>
3382
- <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line683">line 683</a>
2292
+ <a href="Emitter.js.html">Emitter.js</a>, <a href="Emitter.js.html#line474">line 474</a>
3383
2293
  </li></ul></dd>
3384
2294
 
3385
2295
 
@@ -3402,6 +2312,8 @@ the event. False if none are found.
3402
2312
 
3403
2313
 
3404
2314
 
2315
+
2316
+
3405
2317
  <h5>Returns:</h5>
3406
2318
 
3407
2319
 
@@ -3412,18 +2324,6 @@ the event. False if none are found.
3412
2324
 
3413
2325
 
3414
2326
 
3415
- <dl>
3416
- <dt>
3417
- Type
3418
- </dt>
3419
- <dd>
3420
-
3421
- <span class="param-type">boolean</span>
3422
-
3423
-
3424
- </dd>
3425
- </dl>
3426
-
3427
2327
 
3428
2328
 
3429
2329
 
@@ -3452,7 +2352,7 @@ the event. False if none are found.
3452
2352
  <br class="clear">
3453
2353
 
3454
2354
  <footer>
3455
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Jan 22 2019 14:10:25 GMT+0000 (GMT)
2355
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Tue Sep 23 2025 16:47:15 GMT+0100 (Western European Summer Time)
3456
2356
  </footer>
3457
2357
 
3458
2358
  <script> prettyPrint(); </script>