Index: lib/prefs.js |
=================================================================== |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -52,20 +52,24 @@ |
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); |
+ }, |
+ enumerable: true |
}); |
} |