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

Unified Diff: lib/notificationHelper.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Workaround limiation with iterating element collections in older versions of Chrome Created Jan. 16, 2017, 8:46 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
« no previous file with comments | « lib/messaging.js ('k') | lib/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/notificationHelper.js
diff --git a/lib/notificationHelper.js b/lib/notificationHelper.js
index 8c5485835e926436c7c93e7fac0f18d79b2166cd..d0a56b4b78ea84469d6efaf77a1e1d8514c22df4 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");
@@ -38,7 +40,7 @@ let canUseChromeNotifications = typeof chrome != "undefined" && "notifications"
function prepareNotificationIconAndPopup()
{
let animateIcon = shouldDisplay("icon", activeNotification.type);
- activeNotification.onClicked = function()
+ activeNotification.onClicked = () =>
{
if (animateIcon)
stopIconAnimation();
@@ -122,7 +124,7 @@ function notificationButtonClick(buttonIndex)
break;
case "configure":
Prefs.notifications_showui = true;
- ext.showOptions(function(page)
+ ext.showOptions(page =>
{
page.sendMessage({
type: "app.respond",
@@ -152,14 +154,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);
@@ -231,7 +233,7 @@ function showNotification(notification)
/**
* Initializes the notification system.
*/
-exports.initNotifications = function()
+exports.initNotifications = () =>
{
if (canUseChromeNotifications)
initChromeNotifications();
@@ -243,10 +245,7 @@ exports.initNotifications = function()
*
* @return {?object}
*/
-exports.getActiveNotification = function()
-{
- return activeNotification;
-};
+exports.getActiveNotification = () => activeNotification;
let shouldDisplay =
/**
@@ -257,7 +256,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;
« no previous file with comments | « lib/messaging.js ('k') | lib/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld