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

Delta Between Two Patch Sets: lib/notification.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Left Patch Set: Addressed Wladimir's comments Created March 8, 2017, 12:28 p.m.
Right Patch Set: Removed unused imports Created March 15, 2017, 3:11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/matcher.js ('k') | lib/rsa.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 removeNotification(notification) 395 removeNotification(notification)
396 { 396 {
397 let index = localData.indexOf(notification); 397 let index = localData.indexOf(notification);
398 if (index > -1) 398 if (index > -1)
399 localData.splice(index, 1); 399 localData.splice(index, 1);
400 }, 400 },
401 401
402 /** 402 /**
403 * A callback function which listens to see if notifications were approved. 403 * A callback function which listens to see if notifications were approved.
404 * 404 *
405 * @callback questionListener 405 * @callback QuestionListener
406 * @param {boolean} approved 406 * @param {boolean} approved
407 */ 407 */
408 408
409 /** 409 /**
410 * Adds a listener for question-type notifications 410 * Adds a listener for question-type notifications
411 * @param {string} id 411 * @param {string} id
412 * @param {questionListener} listener 412 * @param {QuestionListener} listener
413 */ 413 */
414 addQuestionListener(id, listener) 414 addQuestionListener(id, listener)
415 { 415 {
416 if (!(id in questionListeners)) 416 if (!(id in questionListeners))
417 questionListeners[id] = []; 417 questionListeners[id] = [];
418 if (questionListeners[id].indexOf(listener) === -1) 418 if (questionListeners[id].indexOf(listener) === -1)
419 questionListeners[id].push(listener); 419 questionListeners[id].push(listener);
420 }, 420 },
421 421
422 /** 422 /**
423 * Removes a listener that was previously added via addQuestionListener 423 * Removes a listener that was previously added via addQuestionListener
424 * @param {string} id 424 * @param {string} id
425 * @param {questionListener} listener 425 * @param {QuestionListener} listener
426 */ 426 */
427 removeQuestionListener(id, listener) 427 removeQuestionListener(id, listener)
428 { 428 {
429 if (!(id in questionListeners)) 429 if (!(id in questionListeners))
430 return; 430 return;
431 let index = questionListeners[id].indexOf(listener); 431 let index = questionListeners[id].indexOf(listener);
432 if (index > -1) 432 if (index > -1)
433 questionListeners[id].splice(index, 1); 433 questionListeners[id].splice(index, 1);
434 if (questionListeners[id].length === 0) 434 if (questionListeners[id].length === 0)
435 delete questionListeners[id]; 435 delete questionListeners[id];
(...skipping 30 matching lines...) Expand all
466 else if (index != -1 && forceValue !== true) 466 else if (index != -1 && forceValue !== true)
467 categories.splice(index, 1); 467 categories.splice(index, 1);
468 468
469 // HACK: JSON values aren't saved unless they are assigned a 469 // HACK: JSON values aren't saved unless they are assigned a
470 // different object. 470 // different object.
471 Prefs.notifications_ignoredcategories = 471 Prefs.notifications_ignoredcategories =
472 JSON.parse(JSON.stringify(categories)); 472 JSON.parse(JSON.stringify(categories));
473 } 473 }
474 }; 474 };
475 Notification.init(); 475 Notification.init();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld