| Index: lib/notificationHelper.js |
| diff --git a/lib/notificationHelper.js b/lib/notificationHelper.js |
| index 84f34b3dcf966543a918bfae43efc78bd6565fbe..2aa46171077449372528d3862ef35926c88f32b0 100644 |
| --- a/lib/notificationHelper.js |
| +++ b/lib/notificationHelper.js |
| @@ -17,6 +17,8 @@ |
| /** @module notificationHelper */ |
| +"use strict"; |
| + |
| let {startIconAnimation, stopIconAnimation} = require("icon"); |
| let {Utils} = require("utils"); |
| let {Notification: NotificationStorage} = require("notification"); |
| @@ -33,25 +35,13 @@ displayMethods.question = ["notification"]; |
| displayMethods.normal = ["notification"]; |
| displayMethods.information = ["icon", "popup"]; |
| -// Chrome on Linux does not fully support chrome.notifications until version 35 |
| -// https://code.google.com/p/chromium/issues/detail?id=291485 |
| -let canUseChromeNotifications = (function() |
| -{ |
| - let info = require("info"); |
| - if (info.platform == "chromium" && "notifications" in chrome) |
| - { |
| - if (navigator.platform.indexOf("Linux") == -1) |
| - return true; |
| - if (Services.vc.compare(info.applicationVersion, "35") >= 0) |
| - return true; |
| - } |
| - return false; |
| -})(); |
| +let platform = require("info").platform; |
| +let canUseChromeNotifications = platform == "chromium" && "notifications" in chrome; |
| function prepareNotificationIconAndPopup() |
| { |
| let animateIcon = shouldDisplay("icon", activeNotification.type); |
| - activeNotification.onClicked = function() |
| + activeNotification.onClicked = () => |
| { |
| if (animateIcon) |
| stopIconAnimation(); |
| @@ -135,7 +125,7 @@ function notificationButtonClick(buttonIndex) |
| break; |
| case "configure": |
| Prefs.notifications_showui = true; |
| - ext.showOptions(function(page) |
| + ext.showOptions(page => |
| { |
| page.sendMessage({ |
| type: "app.respond", |
| @@ -165,14 +155,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); |
| @@ -244,7 +234,7 @@ function showNotification(notification) |
| /** |
| * Initializes the notification system. |
| */ |
| -exports.initNotifications = function() |
| +exports.initNotifications = () => |
| { |
| if (canUseChromeNotifications) |
| initChromeNotifications(); |
| @@ -256,10 +246,7 @@ exports.initNotifications = function() |
| * |
| * @return {?object} |
| */ |
| -exports.getActiveNotification = function() |
| -{ |
| - return activeNotification; |
| -}; |
| +exports.getActiveNotification = () => activeNotification; |
| let shouldDisplay = |
| /** |
| @@ -270,7 +257,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; |