mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 00:25:47 +01:00
Convert expression closures to arrow syntax.
This commit is contained in:
@@ -53,7 +53,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
|
||||
this.remaining = addons;
|
||||
this.upgrade = [];
|
||||
this.dactyl.echomsg(_("addon.check", addons.map(function (a) a.name).join(", ")));
|
||||
this.dactyl.echomsg(_("addon.check", addons.map(a => a.name).join(", ")));
|
||||
for (let addon in values(addons))
|
||||
addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null);
|
||||
|
||||
@@ -64,11 +64,11 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
install.install();
|
||||
},
|
||||
onUpdateFinished: function (addon, error) {
|
||||
this.remaining = this.remaining.filter(function (a) a.type != addon.type || a.id != addon.id);
|
||||
this.remaining = this.remaining.filter(a => a.type != addon.type || a.id != addon.id);
|
||||
if (!this.remaining.length)
|
||||
this.dactyl.echomsg(
|
||||
this.upgrade.length
|
||||
? _("addon.installingUpdates", this.upgrade.map(function (i) i.name).join(", "))
|
||||
? _("addon.installingUpdates", this.upgrade.map(i => i.name).join(", "))
|
||||
: _("addon.noUpdates"));
|
||||
}
|
||||
});
|
||||
@@ -118,7 +118,7 @@ var actions = {
|
||||
});
|
||||
},
|
||||
get filter() {
|
||||
return function (addon) !addon.userDisabled &&
|
||||
return addon => !addon.userDisabled &&
|
||||
!(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
|
||||
},
|
||||
perm: "disable"
|
||||
@@ -302,7 +302,7 @@ var AddonList = Class("AddonList", {
|
||||
addon = Addon(addon, this);
|
||||
this.addons[addon.id] = addon;
|
||||
|
||||
let index = values(this.addons).sort(function (a, b) a.compare(b))
|
||||
let index = values(this.addons).sort((a, b) => a.compare(b))
|
||||
.indexOf(addon);
|
||||
|
||||
this.nodes.list.insertBefore(addon.nodes.row,
|
||||
@@ -343,10 +343,10 @@ var AddonList = Class("AddonList", {
|
||||
});
|
||||
|
||||
var Addons = Module("addons", {
|
||||
errors: Class.Memoize(function ()
|
||||
errors: Class.Memoize(() =>
|
||||
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
|
||||
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
|
||||
.map(function (e) [AddonManager[e], _("AddonManager." + e)])
|
||||
.map(e => [AddonManager[e], _("AddonManager." + e)])
|
||||
.toObject())
|
||||
}, {
|
||||
}, {
|
||||
@@ -360,7 +360,7 @@ var Addons = Module("addons", {
|
||||
modules.commandline.echo(addons);
|
||||
|
||||
if (modules.commandline.savingOutput)
|
||||
util.waitFor(function () addons.ready);
|
||||
util.waitFor(() => addons.ready);
|
||||
},
|
||||
{
|
||||
argCount: "?",
|
||||
@@ -398,7 +398,7 @@ var Addons = Module("addons", {
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) {
|
||||
context.filters.push(function ({ isdir, text }) isdir || /\.xpi$/.test(text));
|
||||
context.filters.push(({ isdir, text }) => isdir || /\.xpi$/.test(text));
|
||||
completion.file(context);
|
||||
},
|
||||
literal: 0
|
||||
@@ -420,7 +420,7 @@ var Addons = Module("addons", {
|
||||
|
||||
AddonManager.getAddonsByTypes(args["-types"], dactyl.wrapCallback(function (list) {
|
||||
if (!args.bang || command.bang) {
|
||||
list = list.filter(function (addon) addon.id == name || addon.name == name);
|
||||
list = list.filter(addon => addon.id == name || addon.name == name);
|
||||
dactyl.assert(list.length, _("error.invalidArgument", name));
|
||||
dactyl.assert(list.some(ok), _("error.invalidOperation"));
|
||||
list = list.filter(ok);
|
||||
@@ -429,14 +429,14 @@ var Addons = Module("addons", {
|
||||
if (command.actions)
|
||||
command.actions(list, this.modules);
|
||||
else
|
||||
list.forEach(function (addon) command.action.call(this.modules, addon, args.bang), this);
|
||||
list.forEach(addon => command.action.call(this.modules, addon, args.bang));
|
||||
}));
|
||||
}, {
|
||||
argCount: "?", // FIXME: should be "1"
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
completion.addon(context, args["-types"]);
|
||||
context.filters.push(function ({ item }) ok(item));
|
||||
context.filters.push(({ item }) => ok(item));
|
||||
},
|
||||
literal: 0,
|
||||
options: [
|
||||
@@ -455,7 +455,7 @@ var Addons = Module("addons", {
|
||||
completion.addonType = function addonType(context) {
|
||||
let base = ["extension", "theme"];
|
||||
function update(types) {
|
||||
context.completions = types.map(function (t) [t, util.capitalize(t)]);
|
||||
context.completions = types.map(t => [t, util.capitalize(t)]);
|
||||
}
|
||||
|
||||
context.generate = function generate() {
|
||||
@@ -464,7 +464,7 @@ var Addons = Module("addons", {
|
||||
context.incomplete = true;
|
||||
AddonManager.getAllAddons(function (addons) {
|
||||
context.incomplete = false;
|
||||
update(array.uniq(base.concat(addons.map(function (a) a.type)),
|
||||
update(array.uniq(base.concat(addons.map(a => a.type)),
|
||||
true));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user