1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 19:47:59 +01:00

Move Map's property definitions outside init.

--HG--
extra : rebase_source : 6ab30f7e512283852024f2de6abc69f203f5e8d3
This commit is contained in:
Doug Kearns
2009-11-16 23:45:11 +11:00
parent bda2e685f8
commit 230490db05
2 changed files with 40 additions and 33 deletions

View File

@@ -45,7 +45,7 @@ const Command = Class("Command", {
extraInfo = {};
this.specs = specs;
this.shortNames = expandedSpecs.map(function (n) n[1]);
this.shortNames = array(expandedSpecs).map(function (n) n[1]).compact();
this.longNames = expandedSpecs.map(function (n) n[0]);
this.name = this.longNames[0];
this.names = array(expandedSpecs).flatten();

View File

@@ -34,43 +34,50 @@ const Map = Class("Map", {
if (!extraInfo)
extraInfo = {};
/** @property {number[]} All of the modes for which this mapping applies. */
this.modes = modes;
/** @property {string[]} All of this mapping's names (key sequences). */
this.names = keys.map(events.canonicalKeys);
/** @property {function (number)} The function called to execute this mapping. */
this.action = action;
this.description = description;
update(this, extraInfo);
},
/** @property {number[]} All of the modes for which this mapping applies. */
modes: null,
/** @property {string[]} All of this mapping's names (key sequences). */
names: null,
/** @property {function (number)} The function called to execute this mapping. */
action: null,
/** @property {string} This mapping's description, as shown in :viusage. */
this.description = description || "";
description: "",
/** @property {boolean} Whether this mapping accepts an argument. */
this.arg = extraInfo.arg || false;
arg: false,
/** @property {boolean} Whether this mapping accepts a count. */
this.count = extraInfo.count || false;
count: false,
/**
* @property {boolean} Whether the mapping accepts a motion mapping
* as an argument.
*/
this.motion = extraInfo.motion || false;
motion: false,
/**
* @property {boolean} Whether the mapping's key events should be
* propagated to the host application.
*/
// TODO: I'm not sure this is the best name but it reflects that which it replaced. --djk
this.route = extraInfo.route || false;
route: false,
/** @property {boolean} Whether the RHS of the mapping should expand mappings recursively. */
this.noremap = extraInfo.noremap || false;
noremap: false,
/** @property {boolean} Whether any output from the mapping should be echoed on the command line. */
this.silent = extraInfo.silent || false;
silent: false,
/** @property {string} The literal RHS expansion of this mapping. */
this.rhs = extraInfo.rhs || null;
rhs: null,
/**
* @property {boolean} Specifies whether this is a user mapping. User
* mappings may be created by plugins, or directly by users. Users and
* plugin authors should create only user mappings.
*/
this.user = extraInfo.user || false;
},
user: false,
/**
* Returns whether this mapping can be invoked by a key sequence matching