| 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)); |