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.
|
}); |
} |