1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-31 03:42:27 +01:00

Use Object.defineProperty instead of __defineGetter__/__defineSetter__

In Firefox 48+, the __defineSetter__/__defineSetter__ is deprecated,
so use Object.defineProperty instead.
This commit is contained in:
Zheng Chaoping
2016-05-04 20:00:59 +08:00
parent 1a4290d92a
commit 195ea78efb
20 changed files with 291 additions and 146 deletions

View File

@@ -1060,11 +1060,15 @@ var Options = Module("options", {
memoize(this._options, this._options.length, closure);
// quickly access options with options["wildmode"]:
this.__defineGetter__(name, function () {
return this._optionMap[name].value;
});
this.__defineSetter__(name, function (value) {
this._optionMap[name].value = value;
Object.defineProperty(this, name, {
get() {
return this._optionMap[name].value;
},
set(value) {
this._optionMap[name].value = value;
},
enumerable: true,
configurable: true
});
}
};