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

Unified Diff: lib/prefs.js

Issue 5519479341580288: Issue 2437 - Update adblockplus dependency to revision 752ffe2eeaf1 (Closed)
Patch Set: Use an arrow function and Object.defineProperty Created April 30, 2015, 5:05 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ensure_dependencies.py ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -52,20 +52,23 @@
function defineProperty(key)
{
- Prefs.__defineGetter__(key, function() values[key]);
- Prefs.__defineSetter__(key, function(value)
+ Object.defineProperty(Prefs, key,
{
- if (typeof value != typeof defaults[key])
- throw new Error("Attempt to change preference type");
+ get: () => values[key],
+ set: function(value)
+ {
+ if (typeof value != typeof defaults[key])
+ throw new Error("Attempt to change preference type");
- if (value == defaults[key])
- delete values[key];
- else
- values[key] = value;
- save();
+ if (value == defaults[key])
+ delete values[key];
+ else
+ values[key] = value;
+ save();
- for (let listener of listeners)
- listener(key);
+ for (let listener of listeners)
+ listener(key);
+ }
Wladimir Palant 2015/04/30 08:30:24 enumerable: true please, otherwise debugging will
Felix Dahlke 2015/04/30 13:17:38 Done.
});
}
« no previous file with comments | « ensure_dependencies.py ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld