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

Delta Between Two Patch Sets: lib/events.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Left Patch Set: Stop using commonjs, fix other problems Created Feb. 21, 2017, 5:12 a.m.
Right Patch Set: Removed unused imports Created March 15, 2017, 3:11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/elemHideEmulation.js ('k') | lib/filterClasses.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 { 55 {
56 let idx = listeners.indexOf(listener); 56 let idx = listeners.indexOf(listener);
57 if (idx != -1) 57 if (idx != -1)
58 listeners.splice(idx, 1); 58 listeners.splice(idx, 1);
59 } 59 }
60 }, 60 },
61 61
62 /** 62 /**
63 * Adds a one time listener and returns a promise that 63 * Adds a one time listener and returns a promise that
64 * is resolved the next time the specified event is emitted. 64 * is resolved the next time the specified event is emitted.
65 * @param {String} name 65 * @param {string} name
66 * @return {Promise} 66 * @return {Promise}
67 */ 67 */
68 once(name) 68 once(name)
69 { 69 {
70 return new Promise(resolve => 70 return new Promise(resolve =>
71 { 71 {
72 let listener = () => 72 let listener = () =>
73 { 73 {
74 this.off(name, listener); 74 this.off(name, listener);
75 resolve(); 75 resolve();
(...skipping 21 matching lines...) Expand all
97 * @param {string} name 97 * @param {string} name
98 * @param {...*} [arg] 98 * @param {...*} [arg]
99 */ 99 */
100 emit(name, ...args) 100 emit(name, ...args)
101 { 101 {
102 let listeners = this.listeners(name); 102 let listeners = this.listeners(name);
103 for (let listener of listeners) 103 for (let listener of listeners)
104 listener(...args); 104 listener(...args);
105 } 105 }
106 }; 106 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld