1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-29 05:22:27 +01:00

Merge pull request #160 from zbinlin/patch-1

Use Object.defineProperty instead of __defineGetter__/__defineSetter__
This commit is contained in:
dkearns
2016-08-17 20:28:05 +10:00
committed by GitHub
21 changed files with 292 additions and 147 deletions

View File

@@ -180,8 +180,16 @@ var CommandWidgets = Class("CommandWidgets", {
return (obj.getElement || identity)(map[id] || document.getElementById(prefix + id));
}
this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
this.activeGroup.__defineGetter__(obj.name, () => this.getGroup(obj.name));
Object.defineProperty(this.active, obj.name, {
get: () => this.activeGroup[obj.name][obj.name],
enumerable: true,
configurable: true,
});
Object.defineProperty(this.activeGroup, obj.name, {
get: () => this.getGroup(obj.name),
enumerable: true,
configurable: true,
});
memoize(this.statusbar, obj.name, () => get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
memoize(this.commandbar, obj.name, () => get("dactyl-", {}, (obj.id || obj.name)));