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

Side by Side Diff: lib/prefs.js

Issue 29715577: Issue 6449 - Switch to Harmony modules (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Add lib/.eslintrc.json Created March 6, 2018, 10:30 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /** @module prefs */ 18 /** @module prefs */
19 19
20 "use strict"; 20 import {EventEmitter} from "events";
21
22 const {EventEmitter} = require("events");
23 21
24 const keyPrefix = "pref:"; 22 const keyPrefix = "pref:";
25 23
26 let eventEmitter = new EventEmitter(); 24 let eventEmitter = new EventEmitter();
27 let overrides = Object.create(null); 25 let overrides = Object.create(null);
28 26
29 /** @lends module:prefs.Prefs */ 27 /** @lends module:prefs.Prefs */
30 let defaults = Object.create(null); 28 let defaults = Object.create(null);
31 29
32 /** 30 /**
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * the updates page will be shown to inform the user about intermediate changes. 203 * the updates page will be shown to inform the user about intermediate changes.
206 * 204 *
207 * @type {number} 205 * @type {number}
208 */ 206 */
209 defaults.last_updates_page_displayed = 0; 207 defaults.last_updates_page_displayed = 0;
210 208
211 /** 209 /**
212 * @namespace 210 * @namespace
213 * @static 211 * @static
214 */ 212 */
215 let Prefs = exports.Prefs = { 213 export const Prefs = {
216 /** 214 /**
217 * Adds a callback that is called when the 215 * Adds a callback that is called when the
218 * value of a specified preference changed. 216 * value of a specified preference changed.
219 * 217 *
220 * @param {string} preference 218 * @param {string} preference
221 * @param {function} callback 219 * @param {function} callback
222 */ 220 */
223 on(preference, callback) 221 on(preference, callback)
224 { 222 {
225 eventEmitter.on(preference, callback); 223 eventEmitter.on(preference, callback);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 eventEmitter.emit(pref); 378 eventEmitter.emit(pref);
381 } 379 }
382 } 380 }
383 }); 381 });
384 } 382 }
385 383
386 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 384 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
387 } 385 }
388 386
389 init(); 387 init();
OLDNEW
« lib/.eslintrc.json ('K') | « lib/popupBlocker.js ('k') | lib/requestBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld