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

Unified Diff: lib/notificationHelper.js

Issue 5733084272001024: Issue 2368 - Update adblockplus dependency to revision feb391127fe4 (Closed)
Patch Set: Make URL mandatory Created June 12, 2015, 5 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
« no previous file with comments | « dependencies ('k') | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/notificationHelper.js
===================================================================
--- a/lib/notificationHelper.js
+++ b/lib/notificationHelper.js
@@ -129,25 +129,8 @@
chrome.notifications.onClosed.addListener(notificationClosed);
}
-/**
- * Initializes the notification system.
- */
-exports.initNotifications = function()
+function showNotification(notification)
{
- if (canUseChromeNotifications)
- initChromeNotifications();
- initAntiAdblockNotification();
-};
-
-let showNextNotification =
-/**
- * Shows the next notification from the queue if any.
- *
- * @param {URL} [url] URL to match notifications to
- */
-exports.showNextNotification = function(url)
-{
- let notification = NotificationStorage.getNextToShow(url && stringifyURL(url));
if (!notification || activeNotification && activeNotification.id == notification.id)
return;
@@ -227,6 +210,26 @@
};
/**
+ * Initializes the notification system.
+ */
+exports.initNotifications = function()
+{
+ if (canUseChromeNotifications)
+ initChromeNotifications();
+ initAntiAdblockNotification();
+};
+
+/**
+ * Shows the next notification for the supplied URL, if any.
Sebastian Noack 2015/06/12 17:14:19 Mind removing ", if any", since its mandatory now?
Felix Dahlke 2015/06/12 17:56:11 The "if any" was targeted at the notification, sin
Sebastian Noack 2015/06/12 18:12:51 Argh, you are right. I misread it. I think it make
Felix Dahlke 2015/06/12 18:24:08 Since the caller is not doing anything with the no
+ *
+ * @param {URL} [url] URL to match notifications to
Sebastian Noack 2015/06/12 17:14:19 Square brackets mean optional, which it isn't anym
Felix Dahlke 2015/06/12 17:56:11 Done.
+ */
+exports.showNextNotificationForUrl = function(url)
+{
+ NotificationStorage.showNext(stringifyURL(url));
+}
+
+/**
* Gets the active notification to be shown if any.
*
* @return {?object}
@@ -236,4 +239,7 @@
return activeNotification;
};
-setTimeout(showNextNotification, 3 * 60 * 1000);
+NotificationStorage.addShowListener(function(notification)
+{
+ showNotification(notification);
+});
« no previous file with comments | « dependencies ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld