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

Side by Side Diff: lib/notificationHelper.js

Issue 29730611: Issue 6511 - Use messaging to register popup notification clicks (Closed)
Patch Set: Created March 22, 2018, 2:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 * @param {string} method Display method: icon, notification or popup 287 * @param {string} method Display method: icon, notification or popup
288 * @param {string} notificationType 288 * @param {string} notificationType
289 * @return {boolean} 289 * @return {boolean}
290 */ 290 */
291 exports.shouldDisplay = (method, notificationType) => 291 exports.shouldDisplay = (method, notificationType) =>
292 { 292 {
293 let methods = displayMethods[notificationType] || defaultDisplayMethods; 293 let methods = displayMethods[notificationType] || defaultDisplayMethods;
294 return methods.includes(method); 294 return methods.includes(method);
295 }; 295 };
296 296
297 /**
298 * Tidies up after a notification was clicked.
299 */
300 exports.notificationClicked = () =>
301 {
302 if (activeNotification)
303 activeNotification.onClicked();
304 };
305
297 ext.pages.onLoading.addListener(page => 306 ext.pages.onLoading.addListener(page =>
298 { 307 {
299 NotificationStorage.showNext(stringifyURL(page.url)); 308 NotificationStorage.showNext(stringifyURL(page.url));
300 }); 309 });
301 310
302 NotificationStorage.addShowListener(showNotification); 311 NotificationStorage.addShowListener(showNotification);
OLDNEW

Powered by Google App Engine
This is Rietveld