1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-01 14:32:25 +01:00

Add :pin and :unpin. Closes issue #344.

This commit is contained in:
Kris Maglione
2011-03-11 13:55:08 -05:00
parent 33ed8c4c28
commit abe1bf9a27
8 changed files with 119 additions and 47 deletions

View File

@@ -447,7 +447,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
* Adds a new command to the builtin hive. Accessible only to core
* dactyl code. Plugins should use group.commands.add instead.
*
* @param {string[]} names The names by which this command can be
* @param {string[]} specs The names by which this command can be
* invoked. The first name specified is the command's canonical
* name.
* @param {string} description A description of the command.
@@ -455,7 +455,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
* @param {Object} extra An optional extra configuration hash.
* @optional
*/
add: function add(names, description, action, extra, replace) {
add: function add(specs, description, action, extra, replace) {
const { commands, contexts } = this.modules;
extra = extra || {};
@@ -463,7 +463,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
extra.definedAt = contexts.getCaller(Components.stack.caller);
extra.hive = this;
extra.parsedSpecs = Command.parseSpecs(names);
extra.parsedSpecs = Command.parseSpecs(specs);
let names = array.flatten(extra.parsedSpecs);
let name = names[0];
@@ -483,7 +483,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
let self = this;
let closure = function () self._map[name];
memoize(this._map, name, function () commands.Command(names, description, action, extra));
memoize(this._map, name, function () commands.Command(specs, description, action, extra));
memoize(this._list, this._list.length, closure);
for (let alias in values(names.slice(1)))
memoize(this._map, alias, closure);