-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2010 by Doug Kearns <dougkearns@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
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);
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"));
}
});
});
},
get filter() {
- return function (addon) !addon.userDisabled &&
- !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
+ return addon => (
+ !addon.userDisabled &&
+ !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE
+ | AddonManager.OP_NEEDS_RESTART_DISABLE)));
},
perm: "disable"
},
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,
});
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())
}, {
}, {
modules.commandline.echo(addons);
if (modules.commandline.savingOutput)
- util.waitFor(function () addons.ready);
+ util.waitFor(() => addons.ready);
},
{
argCount: "?",
}, {
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
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);
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: [
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() {
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));
});
}
context.title = ["Add-on"];
context.anchored = false;
context.keys = {
- text: function (addon) [addon.name, addon.id],
+ text: addon => [addon.name, addon.id],
description: "description",
icon: "iconURL"
};