1 | <!DOCTYPE html>
|
2 | <html lang="en">
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <title>JSDoc: Class: LokiEventEmitter</title>
|
6 |
|
7 | <script src="scripts/prettify/prettify.js"> </script>
|
8 | <script src="scripts/prettify/lang-css.js"> </script>
|
9 | |
10 |
|
11 |
|
12 | <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
13 | <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
14 | </head>
|
15 |
|
16 | <body>
|
17 |
|
18 | <div id="main">
|
19 |
|
20 | <h1 class="page-title">Class: LokiEventEmitter</h1>
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | <section>
|
28 |
|
29 | <header>
|
30 |
|
31 | <h2>LokiEventEmitter</h2>
|
32 |
|
33 |
|
34 | </header>
|
35 |
|
36 | <article>
|
37 | <div class="container-overview">
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | <h4 class="name" id="LokiEventEmitter"><span class="type-signature"></span>new LokiEventEmitter<span class="signature">()</span><span class="type-signature"></span></h4>
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | <div class="description">
|
50 | <p>LokiEventEmitter is a minimalist version of EventEmitter. It enables any
|
51 | constructor that inherits EventEmitter to emit events and trigger
|
52 | listeners that have been added to the event through the on(event, callback) method</p>
|
53 | </div>
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | <dl class="details">
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | <dt class="tag-source">Source:</dt>
|
95 | <dd class="tag-source"><ul class="dummy"><li>
|
96 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line495">line 495</a>
|
97 | </li></ul></dd>
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | </dl>
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | </div>
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | <h3 class="subsection-title">Members</h3>
|
137 |
|
138 |
|
139 |
|
140 | <h4 class="name" id="addListener"><span class="type-signature"></span>addListener<span class="type-signature"></span></h4>
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | <div class="description">
|
146 | <p>Alias of LokiEventEmitter.prototype.on
|
147 | addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event</p>
|
148 | </div>
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | <dl class="details">
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | <dt class="tag-source">Source:</dt>
|
184 | <dd class="tag-source"><ul class="dummy"><li>
|
185 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line578">line 578</a>
|
186 | </li></ul></dd>
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 | </dl>
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | <h4 class="name" id="asyncListeners"><span class="type-signature"></span>asyncListeners<span class="type-signature"></span></h4>
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | <h5 class="subsection-title">Properties:</h5>
|
215 |
|
216 |
|
217 |
|
218 | <table class="props">
|
219 | <thead>
|
220 | <tr>
|
221 |
|
222 | <th>Name</th>
|
223 |
|
224 |
|
225 | <th>Type</th>
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | <th class="last">Description</th>
|
232 | </tr>
|
233 | </thead>
|
234 |
|
235 | <tbody>
|
236 |
|
237 |
|
238 | <tr>
|
239 |
|
240 | <td class="name"><code>asyncListeners</code></td>
|
241 |
|
242 |
|
243 | <td class="type">
|
244 |
|
245 |
|
246 | <span class="param-type">boolean</span>
|
247 |
|
248 |
|
249 |
|
250 | </td>
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 | <td class="description last"><p>boolean determines whether or not the callbacks associated with each event
|
257 | should happen in an async fashion or not
|
258 | Default is false, which means events are synchronous</p></td>
|
259 | </tr>
|
260 |
|
261 |
|
262 | </tbody>
|
263 | </table>
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | <dl class="details">
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | <dt class="tag-source">Source:</dt>
|
296 | <dd class="tag-source"><ul class="dummy"><li>
|
297 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line516">line 516</a>
|
298 | </li></ul></dd>
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 | </dl>
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 | <h4 class="name" id="events"><span class="type-signature"></span>events<span class="type-signature"></span></h4>
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 | <h5 class="subsection-title">Properties:</h5>
|
327 |
|
328 |
|
329 |
|
330 | <table class="props">
|
331 | <thead>
|
332 | <tr>
|
333 |
|
334 | <th>Name</th>
|
335 |
|
336 |
|
337 | <th>Type</th>
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 | <th class="last">Description</th>
|
344 | </tr>
|
345 | </thead>
|
346 |
|
347 | <tbody>
|
348 |
|
349 |
|
350 | <tr>
|
351 |
|
352 | <td class="name"><code>events</code></td>
|
353 |
|
354 |
|
355 | <td class="type">
|
356 |
|
357 |
|
358 | <span class="param-type">hashmap</span>
|
359 |
|
360 |
|
361 |
|
362 | </td>
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 | <td class="description last"><p>a hashmap, with each property being an array of callbacks</p></td>
|
369 | </tr>
|
370 |
|
371 |
|
372 | </tbody>
|
373 | </table>
|
374 |
|
375 |
|
376 |
|
377 |
|
378 | <dl class="details">
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 | <dt class="tag-source">Source:</dt>
|
406 | <dd class="tag-source"><ul class="dummy"><li>
|
407 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line508">line 508</a>
|
408 | </li></ul></dd>
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | </dl>
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 | <h3 class="subsection-title">Methods</h3>
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 | <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(eventName, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 | <div class="description">
|
441 | <p>emit(eventName, data) - emits a particular event
|
442 | with the option of passing optional parameters which are going to be processed by the callback
|
443 | provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters)</p>
|
444 | </div>
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | <h5>Parameters:</h5>
|
455 |
|
456 |
|
457 | <table class="params">
|
458 | <thead>
|
459 | <tr>
|
460 |
|
461 | <th>Name</th>
|
462 |
|
463 |
|
464 | <th>Type</th>
|
465 |
|
466 |
|
467 | <th>Attributes</th>
|
468 |
|
469 |
|
470 |
|
471 |
|
472 | <th class="last">Description</th>
|
473 | </tr>
|
474 | </thead>
|
475 |
|
476 | <tbody>
|
477 |
|
478 |
|
479 | <tr>
|
480 |
|
481 | <td class="name"><code>eventName</code></td>
|
482 |
|
483 |
|
484 | <td class="type">
|
485 |
|
486 |
|
487 | <span class="param-type">string</span>
|
488 |
|
489 |
|
490 |
|
491 | </td>
|
492 |
|
493 |
|
494 | <td class="attributes">
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | </td>
|
501 |
|
502 |
|
503 |
|
504 |
|
505 | <td class="description last"><p>the name of the event</p></td>
|
506 | </tr>
|
507 |
|
508 |
|
509 |
|
510 | <tr>
|
511 |
|
512 | <td class="name"><code>data</code></td>
|
513 |
|
514 |
|
515 | <td class="type">
|
516 |
|
517 |
|
518 | <span class="param-type">object</span>
|
519 |
|
520 |
|
521 |
|
522 | </td>
|
523 |
|
524 |
|
525 | <td class="attributes">
|
526 |
|
527 | <optional><br>
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | </td>
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | <td class="description last"><p>optional object passed with the event</p></td>
|
539 | </tr>
|
540 |
|
541 |
|
542 | </tbody>
|
543 | </table>
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 | <dl class="details">
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 | <dt class="tag-source">Source:</dt>
|
578 | <dd class="tag-source"><ul class="dummy"><li>
|
579 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line552">line 552</a>
|
580 | </li></ul></dd>
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | </dl>
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 | <h4 class="name" id="on"><span class="type-signature"></span>on<span class="signature">(eventName, listener)</span><span class="type-signature"> → {int}</span></h4>
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 | <div class="description">
|
617 | <p>on(eventName, listener) - adds a listener to the queue of callbacks associated to an event</p>
|
618 | </div>
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 | <h5>Parameters:</h5>
|
629 |
|
630 |
|
631 | <table class="params">
|
632 | <thead>
|
633 | <tr>
|
634 |
|
635 | <th>Name</th>
|
636 |
|
637 |
|
638 | <th>Type</th>
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 | <th class="last">Description</th>
|
645 | </tr>
|
646 | </thead>
|
647 |
|
648 | <tbody>
|
649 |
|
650 |
|
651 | <tr>
|
652 |
|
653 | <td class="name"><code>eventName</code></td>
|
654 |
|
655 |
|
656 | <td class="type">
|
657 |
|
658 |
|
659 | <span class="param-type">string</span>
|
660 | |
|
661 |
|
662 | <span class="param-type">Array.<string></span>
|
663 |
|
664 |
|
665 |
|
666 | </td>
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 | <td class="description last"><p>the name(s) of the event(s) to listen to</p></td>
|
673 | </tr>
|
674 |
|
675 |
|
676 |
|
677 | <tr>
|
678 |
|
679 | <td class="name"><code>listener</code></td>
|
680 |
|
681 |
|
682 | <td class="type">
|
683 |
|
684 |
|
685 | <span class="param-type">function</span>
|
686 |
|
687 |
|
688 |
|
689 | </td>
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 | <td class="description last"><p>callback function of listener to attach</p></td>
|
696 | </tr>
|
697 |
|
698 |
|
699 | </tbody>
|
700 | </table>
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 | <dl class="details">
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 | <dt class="tag-source">Source:</dt>
|
735 | <dd class="tag-source"><ul class="dummy"><li>
|
736 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line525">line 525</a>
|
737 | </li></ul></dd>
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 | </dl>
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 | <h5>Returns:</h5>
|
760 |
|
761 |
|
762 | <div class="param-desc">
|
763 | <p>the index of the callback in the array of listeners for a particular event</p>
|
764 | </div>
|
765 |
|
766 |
|
767 |
|
768 | <dl>
|
769 | <dt>
|
770 | Type
|
771 | </dt>
|
772 | <dd>
|
773 |
|
774 | <span class="param-type">int</span>
|
775 |
|
776 |
|
777 | </dd>
|
778 | </dl>
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 | <h4 class="name" id="removeListener"><span class="type-signature"></span>removeListener<span class="signature">(eventName, listener)</span><span class="type-signature"></span></h4>
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 | <div class="description">
|
796 | <p>removeListener() - removes the listener at position 'index' from the event 'eventName'</p>
|
797 | </div>
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 | <h5>Parameters:</h5>
|
808 |
|
809 |
|
810 | <table class="params">
|
811 | <thead>
|
812 | <tr>
|
813 |
|
814 | <th>Name</th>
|
815 |
|
816 |
|
817 | <th>Type</th>
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 | <th class="last">Description</th>
|
824 | </tr>
|
825 | </thead>
|
826 |
|
827 | <tbody>
|
828 |
|
829 |
|
830 | <tr>
|
831 |
|
832 | <td class="name"><code>eventName</code></td>
|
833 |
|
834 |
|
835 | <td class="type">
|
836 |
|
837 |
|
838 | <span class="param-type">string</span>
|
839 | |
|
840 |
|
841 | <span class="param-type">Array.<string></span>
|
842 |
|
843 |
|
844 |
|
845 | </td>
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 | <td class="description last"><p>the name(s) of the event(s) which the listener is attached to</p></td>
|
852 | </tr>
|
853 |
|
854 |
|
855 |
|
856 | <tr>
|
857 |
|
858 | <td class="name"><code>listener</code></td>
|
859 |
|
860 |
|
861 | <td class="type">
|
862 |
|
863 |
|
864 | <span class="param-type">function</span>
|
865 |
|
866 |
|
867 |
|
868 | </td>
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | <td class="description last"><p>the listener callback function to remove from emitter</p></td>
|
875 | </tr>
|
876 |
|
877 |
|
878 | </tbody>
|
879 | </table>
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 | <dl class="details">
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 | <dt class="tag-source">Source:</dt>
|
914 | <dd class="tag-source"><ul class="dummy"><li>
|
915 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line586">line 586</a>
|
916 | </li></ul></dd>
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 | </dl>
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 | </article>
|
948 |
|
949 | </section>
|
950 |
|
951 |
|
952 |
|
953 |
|
954 | </div>
|
955 |
|
956 | <nav>
|
957 | <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Collection.html">Collection</a></li><li><a href="DynamicView.html">DynamicView</a></li><li><a href="Loki.html">Loki</a></li><li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li><li><a href="LokiFsAdapter.html">LokiFsAdapter</a></li><li><a href="LokiFsStructuredAdapter.html">LokiFsStructuredAdapter</a></li><li><a href="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="LokiMemoryAdapter.html">LokiMemoryAdapter</a></li><li><a href="LokiPartitioningAdapter.html">LokiPartitioningAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-Autoupdating Collections.html">Autoupdating Collections</a></li><li><a href="tutorial-Changes API.html">Changes API</a></li><li><a href="tutorial-Collection Transforms.html">Collection Transforms</a></li><li><a href="tutorial-Indexing and Query performance.html">Indexing and Query performance</a></li><li><a href="tutorial-Loki Angular.html">Loki Angular</a></li><li><a href="tutorial-Persistence Adapters.html">Persistence Adapters</a></li><li><a href="tutorial-Query Examples.html">Query Examples</a></li></ul>
|
958 | </nav>
|
959 |
|
960 | <br class="clear">
|
961 |
|
962 | <footer>
|
963 | Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Dec 18 2016 19:39:52 GMT-0500 (Eastern Standard Time)
|
964 | </footer>
|
965 |
|
966 | <script> prettyPrint(); </script>
|
967 | <script src="scripts/linenumber.js"> </script>
|
968 | </body>
|
969 | </html> |
\ | No newline at end of file |