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

Side by Side Diff: lib/subscriptionClasses.js

Issue 29868577: Issue 6891 - Rename FilterNotifier to filterNotifier (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 29, 2018, 2 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
« no previous file with comments | « lib/filterStorage.js ('k') | lib/synchronizer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict"; 18 "use strict";
19 19
20 /** 20 /**
21 * @fileOverview Definition of Subscription class and its subclasses. 21 * @fileOverview Definition of Subscription class and its subclasses.
22 */ 22 */
23 23
24 const {ActiveFilter, BlockingFilter, 24 const {ActiveFilter, BlockingFilter,
25 WhitelistFilter, ElemHideBase} = require("./filterClasses"); 25 WhitelistFilter, ElemHideBase} = require("./filterClasses");
26 const {FilterNotifier} = require("./filterNotifier"); 26 const {filterNotifier} = require("./filterNotifier");
27 const {extend} = require("./coreUtils"); 27 const {extend} = require("./coreUtils");
28 28
29 /** 29 /**
30 * Abstract base class for filter subscriptions 30 * Abstract base class for filter subscriptions
31 * 31 *
32 * @param {string} url download location of the subscription 32 * @param {string} url download location of the subscription
33 * @param {string} [title] title of the filter subscription 33 * @param {string} [title] title of the filter subscription
34 * @constructor 34 * @constructor
35 */ 35 */
36 function Subscription(url, title) 36 function Subscription(url, title)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 get title() 74 get title()
75 { 75 {
76 return this._title; 76 return this._title;
77 }, 77 },
78 set title(value) 78 set title(value)
79 { 79 {
80 if (value != this._title) 80 if (value != this._title)
81 { 81 {
82 let oldValue = this._title; 82 let oldValue = this._title;
83 this._title = value; 83 this._title = value;
84 FilterNotifier.emit("subscription.title", this, value, oldValue); 84 filterNotifier.emit("subscription.title", this, value, oldValue);
85 } 85 }
86 return this._title; 86 return this._title;
87 }, 87 },
88 88
89 /** 89 /**
90 * Determines whether the title should be editable 90 * Determines whether the title should be editable
91 * @type {boolean} 91 * @type {boolean}
92 */ 92 */
93 get fixedTitle() 93 get fixedTitle()
94 { 94 {
95 return this._fixedTitle; 95 return this._fixedTitle;
96 }, 96 },
97 set fixedTitle(value) 97 set fixedTitle(value)
98 { 98 {
99 if (value != this._fixedTitle) 99 if (value != this._fixedTitle)
100 { 100 {
101 let oldValue = this._fixedTitle; 101 let oldValue = this._fixedTitle;
102 this._fixedTitle = value; 102 this._fixedTitle = value;
103 FilterNotifier.emit("subscription.fixedTitle", this, value, oldValue); 103 filterNotifier.emit("subscription.fixedTitle", this, value, oldValue);
104 } 104 }
105 return this._fixedTitle; 105 return this._fixedTitle;
106 }, 106 },
107 107
108 /** 108 /**
109 * Defines whether the filters in the subscription should be disabled 109 * Defines whether the filters in the subscription should be disabled
110 * @type {boolean} 110 * @type {boolean}
111 */ 111 */
112 get disabled() 112 get disabled()
113 { 113 {
114 return this._disabled; 114 return this._disabled;
115 }, 115 },
116 set disabled(value) 116 set disabled(value)
117 { 117 {
118 if (value != this._disabled) 118 if (value != this._disabled)
119 { 119 {
120 let oldValue = this._disabled; 120 let oldValue = this._disabled;
121 this._disabled = value; 121 this._disabled = value;
122 FilterNotifier.emit("subscription.disabled", this, value, oldValue); 122 filterNotifier.emit("subscription.disabled", this, value, oldValue);
123 } 123 }
124 return this._disabled; 124 return this._disabled;
125 }, 125 },
126 126
127 /** 127 /**
128 * Serializes the subscription to an array of strings for writing 128 * Serializes the subscription to an array of strings for writing
129 * out on the disk. 129 * out on the disk.
130 * @param {string[]} buffer buffer to push the serialization results into 130 * @param {string[]} buffer buffer to push the serialization results into
131 */ 131 */
132 serialize(buffer) 132 serialize(buffer)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 get homepage() 363 get homepage()
364 { 364 {
365 return this._homepage; 365 return this._homepage;
366 }, 366 },
367 set homepage(value) 367 set homepage(value)
368 { 368 {
369 if (value != this._homepage) 369 if (value != this._homepage)
370 { 370 {
371 let oldValue = this._homepage; 371 let oldValue = this._homepage;
372 this._homepage = value; 372 this._homepage = value;
373 FilterNotifier.emit("subscription.homepage", this, value, oldValue); 373 filterNotifier.emit("subscription.homepage", this, value, oldValue);
374 } 374 }
375 return this._homepage; 375 return this._homepage;
376 }, 376 },
377 377
378 /** 378 /**
379 * Time of the last subscription download (in seconds since the 379 * Time of the last subscription download (in seconds since the
380 * beginning of the epoch) 380 * beginning of the epoch)
381 * @type {number} 381 * @type {number}
382 */ 382 */
383 get lastDownload() 383 get lastDownload()
384 { 384 {
385 return this._lastDownload; 385 return this._lastDownload;
386 }, 386 },
387 set lastDownload(value) 387 set lastDownload(value)
388 { 388 {
389 if (value != this._lastDownload) 389 if (value != this._lastDownload)
390 { 390 {
391 let oldValue = this._lastDownload; 391 let oldValue = this._lastDownload;
392 this._lastDownload = value; 392 this._lastDownload = value;
393 FilterNotifier.emit("subscription.lastDownload", this, value, oldValue); 393 filterNotifier.emit("subscription.lastDownload", this, value, oldValue);
394 } 394 }
395 return this._lastDownload; 395 return this._lastDownload;
396 }, 396 },
397 397
398 /** 398 /**
399 * See Subscription.serialize() 399 * See Subscription.serialize()
400 * @inheritdoc 400 * @inheritdoc
401 */ 401 */
402 serialize(buffer) 402 serialize(buffer)
403 { 403 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 * @type {string} 458 * @type {string}
459 */ 459 */
460 get downloadStatus() 460 get downloadStatus()
461 { 461 {
462 return this._downloadStatus; 462 return this._downloadStatus;
463 }, 463 },
464 set downloadStatus(value) 464 set downloadStatus(value)
465 { 465 {
466 let oldValue = this._downloadStatus; 466 let oldValue = this._downloadStatus;
467 this._downloadStatus = value; 467 this._downloadStatus = value;
468 FilterNotifier.emit("subscription.downloadStatus", this, value, oldValue); 468 filterNotifier.emit("subscription.downloadStatus", this, value, oldValue);
469 return this._downloadStatus; 469 return this._downloadStatus;
470 }, 470 },
471 471
472 /** 472 /**
473 * Time of the last successful download (in seconds since the beginning of the 473 * Time of the last successful download (in seconds since the beginning of the
474 * epoch). 474 * epoch).
475 */ 475 */
476 lastSuccess: 0, 476 lastSuccess: 0,
477 477
478 /** 478 /**
479 * Time when the subscription was considered for an update last time 479 * Time when the subscription was considered for an update last time
480 * (in seconds since the beginning of the epoch). This will be used 480 * (in seconds since the beginning of the epoch). This will be used
481 * to increase softExpiration if the user doesn't use Adblock Plus 481 * to increase softExpiration if the user doesn't use Adblock Plus
482 * for some time. 482 * for some time.
483 * @type {number} 483 * @type {number}
484 */ 484 */
485 get lastCheck() 485 get lastCheck()
486 { 486 {
487 return this._lastCheck; 487 return this._lastCheck;
488 }, 488 },
489 set lastCheck(value) 489 set lastCheck(value)
490 { 490 {
491 if (value != this._lastCheck) 491 if (value != this._lastCheck)
492 { 492 {
493 let oldValue = this._lastCheck; 493 let oldValue = this._lastCheck;
494 this._lastCheck = value; 494 this._lastCheck = value;
495 FilterNotifier.emit("subscription.lastCheck", this, value, oldValue); 495 filterNotifier.emit("subscription.lastCheck", this, value, oldValue);
496 } 496 }
497 return this._lastCheck; 497 return this._lastCheck;
498 }, 498 },
499 499
500 /** 500 /**
501 * Hard expiration time of the filter subscription (in seconds since 501 * Hard expiration time of the filter subscription (in seconds since
502 * the beginning of the epoch) 502 * the beginning of the epoch)
503 * @type {number} 503 * @type {number}
504 */ 504 */
505 expires: 0, 505 expires: 0,
(...skipping 12 matching lines...) Expand all
518 get errors() 518 get errors()
519 { 519 {
520 return this._errors; 520 return this._errors;
521 }, 521 },
522 set errors(value) 522 set errors(value)
523 { 523 {
524 if (value != this._errors) 524 if (value != this._errors)
525 { 525 {
526 let oldValue = this._errors; 526 let oldValue = this._errors;
527 this._errors = value; 527 this._errors = value;
528 FilterNotifier.emit("subscription.errors", this, value, oldValue); 528 filterNotifier.emit("subscription.errors", this, value, oldValue);
529 } 529 }
530 return this._errors; 530 return this._errors;
531 }, 531 },
532 532
533 /** 533 /**
534 * Version of the subscription data retrieved on last successful download 534 * Version of the subscription data retrieved on last successful download
535 * @type {number} 535 * @type {number}
536 */ 536 */
537 version: 0, 537 version: 0,
538 538
(...skipping 29 matching lines...) Expand all
568 if (this.errors) 568 if (this.errors)
569 buffer.push("errors=" + this.errors); 569 buffer.push("errors=" + this.errors);
570 if (this.version) 570 if (this.version)
571 buffer.push("version=" + this.version); 571 buffer.push("version=" + this.version);
572 if (this.requiredVersion) 572 if (this.requiredVersion)
573 buffer.push("requiredVersion=" + this.requiredVersion); 573 buffer.push("requiredVersion=" + this.requiredVersion);
574 if (this.downloadCount) 574 if (this.downloadCount)
575 buffer.push("downloadCount=" + this.downloadCount); 575 buffer.push("downloadCount=" + this.downloadCount);
576 } 576 }
577 }); 577 });
OLDNEW
« no previous file with comments | « lib/filterStorage.js ('k') | lib/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld