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

Side by Side Diff: lib/subscriptionClasses.js

Issue 29853561: Issue 6854 - Remove deprecated FilterNotifier methods (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 11, 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 63 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.triggerListeners("subscription.title", 84 FilterNotifier.emit("subscription.title", this, value, oldValue);
85 this, value, oldValue);
86 } 85 }
87 return this._title; 86 return this._title;
88 }, 87 },
89 88
90 /** 89 /**
91 * Determines whether the title should be editable 90 * Determines whether the title should be editable
92 * @type {boolean} 91 * @type {boolean}
93 */ 92 */
94 get fixedTitle() 93 get fixedTitle()
95 { 94 {
96 return this._fixedTitle; 95 return this._fixedTitle;
97 }, 96 },
98 set fixedTitle(value) 97 set fixedTitle(value)
99 { 98 {
100 if (value != this._fixedTitle) 99 if (value != this._fixedTitle)
101 { 100 {
102 let oldValue = this._fixedTitle; 101 let oldValue = this._fixedTitle;
103 this._fixedTitle = value; 102 this._fixedTitle = value;
104 FilterNotifier.triggerListeners("subscription.fixedTitle", 103 FilterNotifier.emit("subscription.fixedTitle", this, value, oldValue);
105 this, value, oldValue);
106 } 104 }
107 return this._fixedTitle; 105 return this._fixedTitle;
108 }, 106 },
109 107
110 /** 108 /**
111 * Defines whether the filters in the subscription should be disabled 109 * Defines whether the filters in the subscription should be disabled
112 * @type {boolean} 110 * @type {boolean}
113 */ 111 */
114 get disabled() 112 get disabled()
115 { 113 {
116 return this._disabled; 114 return this._disabled;
117 }, 115 },
118 set disabled(value) 116 set disabled(value)
119 { 117 {
120 if (value != this._disabled) 118 if (value != this._disabled)
121 { 119 {
122 let oldValue = this._disabled; 120 let oldValue = this._disabled;
123 this._disabled = value; 121 this._disabled = value;
124 FilterNotifier.triggerListeners("subscription.disabled", 122 FilterNotifier.emit("subscription.disabled", this, value, oldValue);
125 this, value, oldValue);
126 } 123 }
127 return this._disabled; 124 return this._disabled;
128 }, 125 },
129 126
130 /** 127 /**
131 * Serializes the subscription to an array of strings for writing 128 * Serializes the subscription to an array of strings for writing
132 * out on the disk. 129 * out on the disk.
133 * @param {string[]} buffer buffer to push the serialization results into 130 * @param {string[]} buffer buffer to push the serialization results into
134 */ 131 */
135 serialize(buffer) 132 serialize(buffer)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 get homepage() 363 get homepage()
367 { 364 {
368 return this._homepage; 365 return this._homepage;
369 }, 366 },
370 set homepage(value) 367 set homepage(value)
371 { 368 {
372 if (value != this._homepage) 369 if (value != this._homepage)
373 { 370 {
374 let oldValue = this._homepage; 371 let oldValue = this._homepage;
375 this._homepage = value; 372 this._homepage = value;
376 FilterNotifier.triggerListeners("subscription.homepage", 373 FilterNotifier.emit("subscription.homepage", this, value, oldValue);
377 this, value, oldValue);
378 } 374 }
379 return this._homepage; 375 return this._homepage;
380 }, 376 },
381 377
382 /** 378 /**
383 * Time of the last subscription download (in seconds since the 379 * Time of the last subscription download (in seconds since the
384 * beginning of the epoch) 380 * beginning of the epoch)
385 * @type {number} 381 * @type {number}
386 */ 382 */
387 get lastDownload() 383 get lastDownload()
388 { 384 {
389 return this._lastDownload; 385 return this._lastDownload;
390 }, 386 },
391 set lastDownload(value) 387 set lastDownload(value)
392 { 388 {
393 if (value != this._lastDownload) 389 if (value != this._lastDownload)
394 { 390 {
395 let oldValue = this._lastDownload; 391 let oldValue = this._lastDownload;
396 this._lastDownload = value; 392 this._lastDownload = value;
397 FilterNotifier.triggerListeners("subscription.lastDownload", 393 FilterNotifier.emit("subscription.lastDownload", this, value, oldValue);
398 this, value, oldValue);
399 } 394 }
400 return this._lastDownload; 395 return this._lastDownload;
401 }, 396 },
402 397
403 /** 398 /**
404 * See Subscription.serialize() 399 * See Subscription.serialize()
405 * @inheritdoc 400 * @inheritdoc
406 */ 401 */
407 serialize(buffer) 402 serialize(buffer)
408 { 403 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 * @type {string} 458 * @type {string}
464 */ 459 */
465 get downloadStatus() 460 get downloadStatus()
466 { 461 {
467 return this._downloadStatus; 462 return this._downloadStatus;
468 }, 463 },
469 set downloadStatus(value) 464 set downloadStatus(value)
470 { 465 {
471 let oldValue = this._downloadStatus; 466 let oldValue = this._downloadStatus;
472 this._downloadStatus = value; 467 this._downloadStatus = value;
473 FilterNotifier.triggerListeners("subscription.downloadStatus", 468 FilterNotifier.emit("subscription.downloadStatus", this, value, oldValue);
474 this, value, oldValue);
475 return this._downloadStatus; 469 return this._downloadStatus;
476 }, 470 },
477 471
478 /** 472 /**
479 * 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
480 * epoch). 474 * epoch).
481 */ 475 */
482 lastSuccess: 0, 476 lastSuccess: 0,
483 477
484 /** 478 /**
485 * Time when the subscription was considered for an update last time 479 * Time when the subscription was considered for an update last time
486 * (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
487 * to increase softExpiration if the user doesn't use Adblock Plus 481 * to increase softExpiration if the user doesn't use Adblock Plus
488 * for some time. 482 * for some time.
489 * @type {number} 483 * @type {number}
490 */ 484 */
491 get lastCheck() 485 get lastCheck()
492 { 486 {
493 return this._lastCheck; 487 return this._lastCheck;
494 }, 488 },
495 set lastCheck(value) 489 set lastCheck(value)
496 { 490 {
497 if (value != this._lastCheck) 491 if (value != this._lastCheck)
498 { 492 {
499 let oldValue = this._lastCheck; 493 let oldValue = this._lastCheck;
500 this._lastCheck = value; 494 this._lastCheck = value;
501 FilterNotifier.triggerListeners("subscription.lastCheck", 495 FilterNotifier.emit("subscription.lastCheck", this, value, oldValue);
502 this, value, oldValue);
503 } 496 }
504 return this._lastCheck; 497 return this._lastCheck;
505 }, 498 },
506 499
507 /** 500 /**
508 * Hard expiration time of the filter subscription (in seconds since 501 * Hard expiration time of the filter subscription (in seconds since
509 * the beginning of the epoch) 502 * the beginning of the epoch)
510 * @type {number} 503 * @type {number}
511 */ 504 */
512 expires: 0, 505 expires: 0,
(...skipping 12 matching lines...) Expand all
525 get errors() 518 get errors()
526 { 519 {
527 return this._errors; 520 return this._errors;
528 }, 521 },
529 set errors(value) 522 set errors(value)
530 { 523 {
531 if (value != this._errors) 524 if (value != this._errors)
532 { 525 {
533 let oldValue = this._errors; 526 let oldValue = this._errors;
534 this._errors = value; 527 this._errors = value;
535 FilterNotifier.triggerListeners("subscription.errors", this, 528 FilterNotifier.emit("subscription.errors", this, value, oldValue);
536 value, oldValue);
537 } 529 }
538 return this._errors; 530 return this._errors;
539 }, 531 },
540 532
541 /** 533 /**
542 * Version of the subscription data retrieved on last successful download 534 * Version of the subscription data retrieved on last successful download
543 * @type {number} 535 * @type {number}
544 */ 536 */
545 version: 0, 537 version: 0,
546 538
(...skipping 29 matching lines...) Expand all
576 if (this.errors) 568 if (this.errors)
577 buffer.push("errors=" + this.errors); 569 buffer.push("errors=" + this.errors);
578 if (this.version) 570 if (this.version)
579 buffer.push("version=" + this.version); 571 buffer.push("version=" + this.version);
580 if (this.requiredVersion) 572 if (this.requiredVersion)
581 buffer.push("requiredVersion=" + this.requiredVersion); 573 buffer.push("requiredVersion=" + this.requiredVersion);
582 if (this.downloadCount) 574 if (this.downloadCount)
583 buffer.push("downloadCount=" + this.downloadCount); 575 buffer.push("downloadCount=" + this.downloadCount);
584 } 576 }
585 }); 577 });
OLDNEW
« no previous file with comments | « lib/filterStorage.js ('k') | lib/synchronizer.js » ('j') | test/filterNotifier.js » ('J')

Powered by Google App Engine
This is Rietveld