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 from the queue if any. |
+ * |
+ * @param {URL} [url] URL to match notifications to (optional) |
+ */ |
+exports.showNextNotification = function(url) |
+{ |
+ NotificationStorage.showNext(url && stringifyURL(url)); |
Sebastian Noack
2015/06/12 09:42:06
Oh wait, I were too quick. The case where url isn'
Sebastian Noack
2015/06/12 09:42:42
s/rudimentary/mandatory/
Felix Dahlke
2015/06/12 17:01:35
Somehow presumed it can be null. But judging from
|
+} |
+ |
+/** |
* 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); |
+}); |