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: Undo accidental whitespace change Created Jan. 16, 2017, 2:57 p.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
Index: lib/notificationHelper.js
diff --git a/lib/notificationHelper.js b/lib/notificationHelper.js
index 9a8875a3ecb3c8357397763406546df3c9371be6..06dd9ce6b841bae5b82bb7a6b48af38e01b5d03b 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");
@@ -36,7 +38,7 @@ displayMethods.information = ["icon", "popup"];
function prepareNotificationIconAndPopup()
{
let animateIcon = shouldDisplay("icon", activeNotification.type);
- activeNotification.onClicked = function()
+ activeNotification.onClicked = () =>
{
if (animateIcon)
stopIconAnimation();
@@ -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;

Powered by Google App Engine
This is Rietveld