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

Unified Diff: lib/notificationHelper.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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/.eslintrc.json ('K') | « lib/messaging.js ('k') | lib/options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/notificationHelper.js
===================================================================
--- a/lib/notificationHelper.js
+++ b/lib/notificationHelper.js
@@ -12,25 +12,23 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
/** @module notificationHelper */
-"use strict";
-
-const {startIconAnimation, stopIconAnimation} = require("icon");
-const {Utils} = require("utils");
-const {Notification: NotificationStorage} = require("notification");
-const {stringifyURL} = require("url");
-const {initAntiAdblockNotification} = require("antiadblockInit");
-const {Prefs} = require("prefs");
-const {showOptions} = require("options");
+import {startIconAnimation, stopIconAnimation} from "icon";
+import {Utils} from "utils";
+import {Notification as NotificationStorage} from "notification";
+import {stringifyURL} from "url";
+import {initAntiAdblockNotification} from "antiadblockInit";
+import {Prefs} from "prefs";
+import {showOptions} from "options";
let activeNotification = null;
let activeButtons = null;
let defaultDisplayMethods = ["popup"];
let displayMethods = Object.create(null);
displayMethods.critical = ["icon", "notification", "popup"];
displayMethods.question = ["notification"];
displayMethods.normal = ["notification"];
@@ -260,40 +258,39 @@
if (notification.type !== "question")
NotificationStorage.markAsShown(notification.id);
}
/**
* Initializes the notification system.
*/
-exports.initNotifications = () =>
+export const initNotifications = () =>
{
if ("notifications" in browser)
initChromeNotifications();
initAntiAdblockNotification();
};
/**
* Gets the active notification to be shown if any.
*
* @return {?object}
*/
-exports.getActiveNotification = () => activeNotification;
+export const getActiveNotification = () => activeNotification;
-let shouldDisplay =
/**
* Determines whether a given display method should be used for a
* specified notification type.
*
* @param {string} method Display method: icon, notification or popup
* @param {string} notificationType
* @return {boolean}
*/
-exports.shouldDisplay = (method, notificationType) =>
+export const shouldDisplay = (method, notificationType) =>
{
let methods = displayMethods[notificationType] || defaultDisplayMethods;
return methods.includes(method);
};
ext.pages.onLoading.addListener(page =>
{
NotificationStorage.showNext(stringifyURL(page.url));
« lib/.eslintrc.json ('K') | « lib/messaging.js ('k') | lib/options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld