1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 12:44:10 +01:00

Replace expression closures (methods).

Expression closures are to be axed. See https://bugzil.la/1083458.
This commit is contained in:
Doug Kearns
2015-07-23 01:55:32 +10:00
parent c035aa936b
commit 77d59cdfd1
45 changed files with 1595 additions and 1045 deletions

View File

@@ -19,12 +19,13 @@ var callResult = function callResult(method, ...args) {
return function (result) { result[method].apply(result, args); };
};
var listener = function listener(action, event)
function addonListener(install) {
var listener = function listener(action, event) {
return function addonListener(install) {
this.dactyl[install.error ? "echoerr" : "echomsg"](
_("addon.error", action, event, (install.name || install.sourceURI.spec) +
(install.error ? ": " + addons.errors[install.error] : "")));
};
};
var AddonListener = Class("AddonListener", {
init: function init(modules) {
@@ -84,14 +85,14 @@ var actions = {
name: "exte[nable]",
description: "Enable an extension",
action: function (addon) { addon.userDisabled = false; },
filter: function (addon) addon.userDisabled,
filter: function (addon) { return addon.userDisabled; },
perm: "enable"
},
disable: {
name: "extd[isable]",
description: "Disable an extension",
action: function (addon) { addon.userDisabled = true; },
filter: function (addon) !addon.userDisabled,
filter: function (addon) { return !addon.userDisabled; },
perm: "disable"
},
options: {
@@ -104,7 +105,9 @@ var actions = {
else
this.dactyl.open(addon.optionsURL, { from: "extoptions" });
},
filter: function (addon) addon.isActive && addon.optionsURL
filter: function (addon) {
return addon.isActive && addon.optionsURL;
}
},
rehash: {
name: "extr[ehash]",
@@ -185,7 +188,9 @@ var Addon = Class("Addon", {
action.actions([this], this.list.modules);
},
compare: function compare(other) String.localeCompare(this.name, other.name),
compare: function compare(other) {
return String.localeCompare(this.name, other.name);
},
get statusInfo() {
let info = this.isActive ? ["span", { highlight: "Enabled" }, "enabled"]
@@ -250,8 +255,8 @@ var Addon = Class("Addon", {
"scope", "screenshots", "size", "sourceURI", "translators", "type", "updateDate", "userDisabled",
"version"].forEach(function (prop) {
Object.defineProperty(Addon.prototype, prop, {
get: function get_proxy() this.addon[prop],
set: function set_proxy(val) this.addon[prop] = val
get: function get_proxy() { return this.addon[prop]; },
set: function set_proxy(val) { this.addon[prop] = val; }
});
});