1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 09:17:58 +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 = {}; extraInfo = {};
this.specs = specs; 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.longNames = expandedSpecs.map(function (n) n[0]);
this.name = this.longNames[0]; this.name = this.longNames[0];
this.names = array(expandedSpecs).flatten(); this.names = array(expandedSpecs).flatten();

View File

@@ -34,44 +34,51 @@ const Map = Class("Map", {
if (!extraInfo) if (!extraInfo)
extraInfo = {}; extraInfo = {};
/** @property {number[]} All of the modes for which this mapping applies. */
this.modes = modes; this.modes = modes;
/** @property {string[]} All of this mapping's names (key sequences). */
this.names = keys.map(events.canonicalKeys); this.names = keys.map(events.canonicalKeys);
/** @property {function (number)} The function called to execute this mapping. */
this.action = action; this.action = action;
/** @property {string} This mapping's description, as shown in :viusage. */ this.description = description;
this.description = description || "";
/** @property {boolean} Whether this mapping accepts an argument. */ update(this, extraInfo);
this.arg = extraInfo.arg || false;
/** @property {boolean} Whether this mapping accepts a count. */
this.count = extraInfo.count || false;
/**
* @property {boolean} Whether the mapping accepts a motion mapping
* as an argument.
*/
this.motion = extraInfo.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;
/** @property {boolean} Whether the RHS of the mapping should expand mappings recursively. */
this.noremap = extraInfo.noremap || false;
/** @property {boolean} Whether any output from the mapping should be echoed on the command line. */
this.silent = extraInfo.silent || false;
/** @property {string} The literal RHS expansion of this mapping. */
this.rhs = extraInfo.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;
}, },
/** @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. */
description: "",
/** @property {boolean} Whether this mapping accepts an argument. */
arg: false,
/** @property {boolean} Whether this mapping accepts a count. */
count: false,
/**
* @property {boolean} Whether the mapping accepts a motion mapping
* as an argument.
*/
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
route: false,
/** @property {boolean} Whether the RHS of the mapping should expand mappings recursively. */
noremap: false,
/** @property {boolean} Whether any output from the mapping should be echoed on the command line. */
silent: false,
/** @property {string} The literal RHS expansion of this mapping. */
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.
*/
user: false,
/** /**
* Returns whether this mapping can be invoked by a key sequence matching * Returns whether this mapping can be invoked by a key sequence matching
* <b>name</b>. * <b>name</b>.