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

Side by Side Diff: lib/synchronizer.js

Issue 29715555: Issue 6447 - Switch to Harmony modules in lib/* (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 6, 2018, 7:42 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
« lib/common.js ('K') | « lib/subscriptionClasses.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
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 "use strict"; 18 "use strict";
19 19
20 /** 20 /**
21 * @fileOverview Manages synchronization of filter subscriptions. 21 * @fileOverview Manages synchronization of filter subscriptions.
22 */ 22 */
23 23
24 const {Downloader, Downloadable, 24 import {Downloader, Downloadable,
25 MILLIS_IN_SECOND, MILLIS_IN_MINUTE, 25 MILLIS_IN_SECOND, MILLIS_IN_MINUTE,
26 MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("./downloader"); 26 MILLIS_IN_HOUR, MILLIS_IN_DAY} from "./downloader";
27 const {Filter} = require("./filterClasses"); 27 import {Filter} from "./filterClasses";
28 const {FilterStorage} = require("./filterStorage"); 28 import {FilterStorage} from "./filterStorage";
29 const {FilterNotifier} = require("./filterNotifier"); 29 import {FilterNotifier} from "./filterNotifier";
30 const {Prefs} = require("prefs"); 30 import {Prefs} from "prefs";
31 const {Subscription, 31 import {Subscription, DownloadableSubscription} from "./subscriptionClasses";
32 DownloadableSubscription} = require("./subscriptionClasses"); 32 import {Utils} from "utils";
33 const {Utils} = require("utils");
34 33
35 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; 34 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE;
36 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; 35 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR;
37 const DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY; 36 const DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY;
38 37
39 /** 38 /**
40 * The object providing actual downloading functionality. 39 * The object providing actual downloading functionality.
41 * @type {Downloader} 40 * @type {Downloader}
42 */ 41 */
43 let downloader = null; 42 let downloader = null;
44 43
45 /** 44 /**
46 * This object is responsible for downloading filter subscriptions whenever 45 * This object is responsible for downloading filter subscriptions whenever
47 * necessary. 46 * necessary.
48 * @class 47 * @class
49 */ 48 */
50 let Synchronizer = exports.Synchronizer = 49 export let Synchronizer = {
51 {
52 /** 50 /**
53 * Called on module startup. 51 * Called on module startup.
54 */ 52 */
55 init() 53 init()
56 { 54 {
57 downloader = new Downloader(this._getDownloadables.bind(this), 55 downloader = new Downloader(this._getDownloadables.bind(this),
58 INITIAL_DELAY, CHECK_INTERVAL); 56 INITIAL_DELAY, CHECK_INTERVAL);
59 onShutdown.add(() => 57 onShutdown.add(() =>
60 { 58 {
61 downloader.cancel(); 59 downloader.cancel();
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 subscription.filters.map(f => f.text).join("\n"); 348 subscription.filters.map(f => f.text).join("\n");
351 redirectCallback("data:text/plain," + encodeURIComponent(data)); 349 redirectCallback("data:text/plain," + encodeURIComponent(data));
352 } 350 }
353 }, false); 351 }, false);
354 request.send(null); 352 request.send(null);
355 } 353 }
356 } 354 }
357 } 355 }
358 }; 356 };
359 Synchronizer.init(); 357 Synchronizer.init();
OLDNEW
« lib/common.js ('K') | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld