Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterNotifier.js

Issue 29729594: Noissue - Use Map to store EventEmitter listeners (Closed)
Patch Set: Created March 21, 2018, 1:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/events.js ('K') | « lib/events.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 29 matching lines...) Expand all
40 */ 40 */
41 exports.FilterNotifier = Object.create(new EventEmitter(), desc({ 41 exports.FilterNotifier = Object.create(new EventEmitter(), desc({
42 /** 42 /**
43 * Adds a listener 43 * Adds a listener
44 * 44 *
45 * @deprecated use FilterNotifier.on(action, callback) 45 * @deprecated use FilterNotifier.on(action, callback)
46 * @param {FilterNotifierCatchAllListener} listener 46 * @param {FilterNotifierCatchAllListener} listener
47 */ 47 */
48 addListener(listener) 48 addListener(listener)
49 { 49 {
50 let listeners = this._listeners[CATCH_ALL]; 50 let listeners = this._listeners.get(CATCH_ALL);
51 if (!listeners || listeners.indexOf(listener) == -1) 51 if (!listeners || listeners.indexOf(listener) == -1)
52 this.on(CATCH_ALL, listener); 52 this.on(CATCH_ALL, listener);
53 }, 53 },
54 54
55 /** 55 /**
56 * Removes a listener that was previosly added via addListener 56 * Removes a listener that was previosly added via addListener
57 * 57 *
58 * @deprecated use FilterNotifier.off(action, callback) 58 * @deprecated use FilterNotifier.off(action, callback)
59 * @param {FilterNotifierCatchAllListener} listener 59 * @param {FilterNotifierCatchAllListener} listener
60 */ 60 */
(...skipping 16 matching lines...) Expand all
77 * @param {*} param2 77 * @param {*} param2
78 * @param {*} param3 78 * @param {*} param3
79 * @deprecated use FilterNotifier.emit(action) 79 * @deprecated use FilterNotifier.emit(action)
80 */ 80 */
81 triggerListeners(action, item, param1, param2, param3) 81 triggerListeners(action, item, param1, param2, param3)
82 { 82 {
83 this.emit(action, item, param1, param2, param3); 83 this.emit(action, item, param1, param2, param3);
84 this.emit(CATCH_ALL, action, item, param1, param2, param3); 84 this.emit(CATCH_ALL, action, item, param1, param2, param3);
85 } 85 }
86 })); 86 }));
OLDNEW
« lib/events.js ('K') | « lib/events.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld