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

Side by Side Diff: lib/subscriptionClasses.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Patch Set: Convert shorthand function expressions to arrow functions, this of course isn't possible for getter… Created May 10, 2014, 12: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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 filters: null, 61 filters: null,
62 62
63 _title: null, 63 _title: null,
64 _fixedTitle: false, 64 _fixedTitle: false,
65 _disabled: false, 65 _disabled: false,
66 66
67 /** 67 /**
68 * Title of the filter subscription 68 * Title of the filter subscription
69 * @type String 69 * @type String
70 */ 70 */
71 get title() this._title, 71 get title() { return this._title; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
72 set title(value) 72 set title(value)
73 { 73 {
74 if (value != this._title) 74 if (value != this._title)
75 { 75 {
76 let oldValue = this._title; 76 let oldValue = this._title;
77 this._title = value; 77 this._title = value;
78 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu e); 78 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu e);
79 } 79 }
80 return this._title; 80 return this._title;
81 }, 81 },
82 82
83 /** 83 /**
84 * Determines whether the title should be editable 84 * Determines whether the title should be editable
85 * @type Boolean 85 * @type Boolean
86 */ 86 */
87 get fixedTitle() this._fixedTitle, 87 get fixedTitle() { return this._fixedTitle; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
88 set fixedTitle(value) 88 set fixedTitle(value)
89 { 89 {
90 if (value != this._fixedTitle) 90 if (value != this._fixedTitle)
91 { 91 {
92 let oldValue = this._fixedTitle; 92 let oldValue = this._fixedTitle;
93 this._fixedTitle = value; 93 this._fixedTitle = value;
94 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol dValue); 94 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol dValue);
95 } 95 }
96 return this._fixedTitle; 96 return this._fixedTitle;
97 }, 97 },
98 98
99 /** 99 /**
100 * Defines whether the filters in the subscription should be disabled 100 * Defines whether the filters in the subscription should be disabled
101 * @type Boolean 101 * @type Boolean
102 */ 102 */
103 get disabled() this._disabled, 103 get disabled() { return this._disabled; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
104 set disabled(value) 104 set disabled(value)
105 { 105 {
106 if (value != this._disabled) 106 if (value != this._disabled)
107 { 107 {
108 let oldValue = this._disabled; 108 let oldValue = this._disabled;
109 this._disabled = value; 109 this._disabled = value;
110 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue); 110 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV alue);
111 } 111 }
112 return this._disabled; 112 return this._disabled;
113 }, 113 },
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return false; 286 return false;
287 }, 287 },
288 288
289 /** 289 /**
290 * See Subscription.serialize() 290 * See Subscription.serialize()
291 */ 291 */
292 serialize: function(buffer) 292 serialize: function(buffer)
293 { 293 {
294 Subscription.prototype.serialize.call(this, buffer); 294 Subscription.prototype.serialize.call(this, buffer);
295 if (this.defaults && this.defaults.length) 295 if (this.defaults && this.defaults.length)
296 buffer.push("defaults=" + this.defaults.filter(function(type) type in Spec ialSubscription.defaultsMap).join(" ")); 296 buffer.push("defaults=" + this.defaults.filter((type) => type in SpecialSu bscription.defaultsMap).join(" "));
297 if (this._lastDownload) 297 if (this._lastDownload)
298 buffer.push("lastDownload=" + this._lastDownload); 298 buffer.push("lastDownload=" + this._lastDownload);
299 } 299 }
300 }; 300 };
301 301
302 SpecialSubscription.defaultsMap = { 302 SpecialSubscription.defaultsMap = {
303 __proto__: null, 303 __proto__: null,
304 "whitelist": WhitelistFilter, 304 "whitelist": WhitelistFilter,
305 "blocking": BlockingFilter, 305 "blocking": BlockingFilter,
306 "elemhide": ElemHideBase 306 "elemhide": ElemHideBase
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 { 359 {
360 __proto__: Subscription.prototype, 360 __proto__: Subscription.prototype,
361 361
362 _homepage: null, 362 _homepage: null,
363 _lastDownload: 0, 363 _lastDownload: 0,
364 364
365 /** 365 /**
366 * Filter subscription homepage if known 366 * Filter subscription homepage if known
367 * @type String 367 * @type String
368 */ 368 */
369 get homepage() this._homepage, 369 get homepage() { return this._homepage; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
370 set homepage(value) 370 set homepage(value)
371 { 371 {
372 if (value != this._homepage) 372 if (value != this._homepage)
373 { 373 {
374 let oldValue = this._homepage; 374 let oldValue = this._homepage;
375 this._homepage = value; 375 this._homepage = value;
376 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV alue); 376 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV alue);
377 } 377 }
378 return this._homepage; 378 return this._homepage;
379 }, 379 },
380 380
381 /** 381 /**
382 * Time of the last subscription download (in seconds since the beginning of t he epoch) 382 * Time of the last subscription download (in seconds since the beginning of t he epoch)
383 * @type Number 383 * @type Number
384 */ 384 */
385 get lastDownload() this._lastDownload, 385 get lastDownload() { return this._lastDownload; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
386 set lastDownload(value) 386 set lastDownload(value)
387 { 387 {
388 if (value != this._lastDownload) 388 if (value != this._lastDownload)
389 { 389 {
390 let oldValue = this._lastDownload; 390 let oldValue = this._lastDownload;
391 this._lastDownload = value; 391 this._lastDownload = value;
392 FilterNotifier.triggerListeners("subscription.lastDownload", this, value, oldValue); 392 FilterNotifier.triggerListeners("subscription.lastDownload", this, value, oldValue);
393 } 393 }
394 return this._lastDownload; 394 return this._lastDownload;
395 }, 395 },
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 __proto__: RegularSubscription.prototype, 451 __proto__: RegularSubscription.prototype,
452 452
453 _downloadStatus: null, 453 _downloadStatus: null,
454 _lastCheck: 0, 454 _lastCheck: 0,
455 _errors: 0, 455 _errors: 0,
456 456
457 /** 457 /**
458 * Status of the last download (ID of a string) 458 * Status of the last download (ID of a string)
459 * @type String 459 * @type String
460 */ 460 */
461 get downloadStatus() this._downloadStatus, 461 get downloadStatus() { return this._downloadStatus; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
462 set downloadStatus(value) 462 set downloadStatus(value)
463 { 463 {
464 let oldValue = this._downloadStatus; 464 let oldValue = this._downloadStatus;
465 this._downloadStatus = value; 465 this._downloadStatus = value;
466 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value, oldValue); 466 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value, oldValue);
467 return this._downloadStatus; 467 return this._downloadStatus;
468 }, 468 },
469 469
470 /** 470 /**
471 * Time of the last successful download (in seconds since the beginning of the 471 * Time of the last successful download (in seconds since the beginning of the
472 * epoch). 472 * epoch).
473 */ 473 */
474 lastSuccess: 0, 474 lastSuccess: 0,
475 475
476 /** 476 /**
477 * Time when the subscription was considered for an update last time (in secon ds 477 * Time when the subscription was considered for an update last time (in secon ds
478 * since the beginning of the epoch). This will be used to increase softExpira tion 478 * since the beginning of the epoch). This will be used to increase softExpira tion
479 * if the user doesn't use Adblock Plus for some time. 479 * if the user doesn't use Adblock Plus for some time.
480 * @type Number 480 * @type Number
481 */ 481 */
482 get lastCheck() this._lastCheck, 482 get lastCheck() { return this._lastCheck; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
483 set lastCheck(value) 483 set lastCheck(value)
484 { 484 {
485 if (value != this._lastCheck) 485 if (value != this._lastCheck)
486 { 486 {
487 let oldValue = this._lastCheck; 487 let oldValue = this._lastCheck;
488 this._lastCheck = value; 488 this._lastCheck = value;
489 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old Value); 489 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old Value);
490 } 490 }
491 return this._lastCheck; 491 return this._lastCheck;
492 }, 492 },
493 493
494 /** 494 /**
495 * Hard expiration time of the filter subscription (in seconds since the begin ning of the epoch) 495 * Hard expiration time of the filter subscription (in seconds since the begin ning of the epoch)
496 * @type Number 496 * @type Number
497 */ 497 */
498 expires: 0, 498 expires: 0,
499 499
500 /** 500 /**
501 * Soft expiration time of the filter subscription (in seconds since the begin ning of the epoch) 501 * Soft expiration time of the filter subscription (in seconds since the begin ning of the epoch)
502 * @type Number 502 * @type Number
503 */ 503 */
504 softExpiration: 0, 504 softExpiration: 0,
505 505
506 /** 506 /**
507 * Number of download failures since last success 507 * Number of download failures since last success
508 * @type Number 508 * @type Number
509 */ 509 */
510 get errors() this._errors, 510 get errors() { return this._errors; },
Wladimir Palant 2014/05/15 07:12:38 Nit: Please add proper line breaks here.
511 set errors(value) 511 set errors(value)
512 { 512 {
513 if (value != this._errors) 513 if (value != this._errors)
514 { 514 {
515 let oldValue = this._errors; 515 let oldValue = this._errors;
516 this._errors = value; 516 this._errors = value;
517 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal ue); 517 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal ue);
518 } 518 }
519 return this._errors; 519 return this._errors;
520 }, 520 },
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (this.softExpiration) 554 if (this.softExpiration)
555 buffer.push("softExpiration=" + this.softExpiration); 555 buffer.push("softExpiration=" + this.softExpiration);
556 if (this.errors) 556 if (this.errors)
557 buffer.push("errors=" + this.errors); 557 buffer.push("errors=" + this.errors);
558 if (this.version) 558 if (this.version)
559 buffer.push("version=" + this.version); 559 buffer.push("version=" + this.version);
560 if (this.requiredVersion) 560 if (this.requiredVersion)
561 buffer.push("requiredVersion=" + this.requiredVersion); 561 buffer.push("requiredVersion=" + this.requiredVersion);
562 } 562 }
563 }; 563 };
OLDNEW

Powered by Google App Engine
This is Rietveld