| Index: lib/downloader.js |
| =================================================================== |
| --- a/lib/downloader.js |
| +++ b/lib/downloader.js |
| @@ -16,45 +16,45 @@ |
| */ |
| "use strict"; |
| /** |
| * @fileOverview Downloads a set of URLs in regular time intervals. |
| */ |
| -const {Utils} = require("utils"); |
| +import {Utils} from "utils"; |
| -const MILLIS_IN_SECOND = exports.MILLIS_IN_SECOND = 1000; |
| -const MILLIS_IN_MINUTE = exports.MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; |
| -const MILLIS_IN_HOUR = exports.MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; |
| -const MILLIS_IN_DAY = exports.MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR; |
| +export const MILLIS_IN_SECOND = 1000; |
| +export const MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND; |
| +export const MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE; |
| +export const MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR; |
| -let Downloader = |
| /** |
| * Creates a new downloader instance. |
| * @param {Function} dataSource |
| * Function that will yield downloadable objects on each check |
| * @param {number} initialDelay |
| * Number of milliseconds to wait before the first check |
| * @param {number} checkInterval |
| * Interval between the checks |
| * @constructor |
| */ |
| -exports.Downloader = function(dataSource, initialDelay, checkInterval) |
| +export function Downloader(dataSource, initialDelay, checkInterval) |
| { |
| this.dataSource = dataSource; |
| this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
| this._timer.initWithCallback(() => |
| { |
| this._timer.delay = checkInterval; |
| this._doCheck(); |
| }, initialDelay, Ci.nsITimer.TYPE_REPEATING_SLACK); |
| this._downloading = Object.create(null); |
| -}; |
| +} |
| + |
| Downloader.prototype = |
| { |
| /** |
| * Timer triggering the downloads. |
| * @type {nsITimer} |
| */ |
| _timer: null, |
| @@ -359,20 +359,21 @@ |
| } |
| }; |
| /** |
| * An object that can be downloaded by the downloadable |
| * @param {string} url URL that has to be requested for the object |
| * @constructor |
| */ |
| -let Downloadable = exports.Downloadable = function Downloadable(url) |
| +export function Downloadable(url) |
| { |
| this.url = url; |
| -}; |
| +} |
| + |
| Downloadable.prototype = |
| { |
| /** |
| * URL that has to be requested for the object. |
| * @type {string} |
| */ |
| url: null, |