Index: lib/notificationHelper.js |
diff --git a/lib/notificationHelper.js b/lib/notificationHelper.js |
index 9a8875a3ecb3c8357397763406546df3c9371be6..d997e851a478fae462f663c28ab25870723df7ef 100644 |
--- a/lib/notificationHelper.js |
+++ b/lib/notificationHelper.js |
@@ -17,12 +17,14 @@ |
/** @module notificationHelper */ |
-let {startIconAnimation, stopIconAnimation} = require("icon"); |
-let {Utils} = require("utils"); |
-let {Notification: NotificationStorage} = require("notification"); |
-let {stringifyURL} = require("url"); |
-let {initAntiAdblockNotification} = require("antiadblockInit"); |
-let {Prefs} = require("prefs"); |
+"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"); |
let activeNotification = null; |
let activeButtons = null; |
@@ -36,7 +38,7 @@ displayMethods.information = ["icon", "popup"]; |
function prepareNotificationIconAndPopup() |
{ |
let animateIcon = shouldDisplay("icon", activeNotification.type); |
- activeNotification.onClicked = function() |
+ activeNotification.onClicked = () => |
{ |
if (animateIcon) |
stopIconAnimation(); |
@@ -62,7 +64,7 @@ function getNotificationButtons(notificationType, message) |
} |
else |
{ |
- let regex = /<a>(.*?)<\/a>/g; |
+ const regex = /<a>(.*?)<\/a>/g; |
let match; |
while (match = regex.exec(message)) |
{ |
@@ -120,7 +122,7 @@ function notificationButtonClick(buttonIndex) |
break; |
case "configure": |
Prefs.notifications_showui = true; |
- ext.showOptions(function(page) |
+ ext.showOptions(page => |
{ |
page.sendMessage({ |
type: "app.respond", |
@@ -150,14 +152,14 @@ function initChromeNotifications() |
if (activeNotification && activeNotification.type != "question" && !("links" in activeNotification)) |
return; |
- chrome.notifications.clear(notificationId, function(wasCleared) |
+ chrome.notifications.clear(notificationId, wasCleared => |
{ |
if (wasCleared) |
notificationClosed(); |
}); |
} |
- chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex) |
+ chrome.notifications.onButtonClicked.addListener((notificationId, buttonIndex) => |
{ |
notificationButtonClick(buttonIndex); |
clearActiveNotification(notificationId); |
@@ -229,7 +231,7 @@ function showNotification(notification) |
/** |
* Initializes the notification system. |
*/ |
-exports.initNotifications = function() |
+exports.initNotifications = () => |
{ |
if ("notifications" in chrome) |
initChromeNotifications(); |
@@ -241,10 +243,7 @@ exports.initNotifications = function() |
* |
* @return {?object} |
*/ |
-exports.getActiveNotification = function() |
-{ |
- return activeNotification; |
-}; |
+exports.getActiveNotification = () => activeNotification; |
let shouldDisplay = |
/** |
@@ -255,7 +254,7 @@ let shouldDisplay = |
* @param {string} notificationType |
* @return {boolean} |
*/ |
-exports.shouldDisplay = function(method, notificationType) |
+exports.shouldDisplay = (method, notificationType) => |
{ |
let methods = displayMethods[notificationType] || defaultDisplayMethods; |
return methods.indexOf(method) > -1; |