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: Created Jan. 13, 2017, 12:11 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
« chrome/ext/common.js ('K') | « lib/io.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 6341e81ad8ec88e7ed5e378313dfa4a73a698929..e5c23def4a6e6054d751822a501bd0dd410dd4b5 100644
--- a/lib/notificationHelper.js
+++ b/lib/notificationHelper.js
@@ -39,7 +39,7 @@ let canUseChromeNotifications = platform == "chromium" && "notifications" in chr
function prepareNotificationIconAndPopup()
{
let animateIcon = shouldDisplay("icon", activeNotification.type);
- activeNotification.onClicked = function()
+ activeNotification.onClicked = () =>
{
if (animateIcon)
stopIconAnimation();
@@ -123,7 +123,7 @@ function notificationButtonClick(buttonIndex)
break;
case "configure":
Prefs.notifications_showui = true;
- ext.showOptions(function(page)
+ ext.showOptions(page =>
{
page.sendMessage({
type: "app.respond",
@@ -153,14 +153,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);
@@ -232,7 +232,7 @@ function showNotification(notification)
/**
* Initializes the notification system.
*/
-exports.initNotifications = function()
+exports.initNotifications = () =>
{
if (canUseChromeNotifications)
initChromeNotifications();
@@ -244,10 +244,7 @@ exports.initNotifications = function()
*
* @return {?object}
*/
-exports.getActiveNotification = function()
-{
- return activeNotification;
-};
+exports.getActiveNotification = () => activeNotification;
let shouldDisplay =
/**
@@ -258,7 +255,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;
« chrome/ext/common.js ('K') | « lib/io.js ('k') | lib/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld