Support named function in lieu of command name as first argument
This commit is contained in:
parent
4d97452b15
commit
918ef23773
1 changed files with 8 additions and 0 deletions
|
@ -42,6 +42,14 @@ var executeCmd = function( args, player ) {
|
||||||
define a new JSP command.
|
define a new JSP command.
|
||||||
*/
|
*/
|
||||||
var defineCmd = function( name, func, options, intercepts ) {
|
var defineCmd = function( name, func, options, intercepts ) {
|
||||||
|
|
||||||
|
if ( typeof name == 'function'){
|
||||||
|
intercepts = options;
|
||||||
|
options = func;
|
||||||
|
func = name;
|
||||||
|
name = func.name;
|
||||||
|
}
|
||||||
|
|
||||||
if ( typeof options == 'undefined' ) {
|
if ( typeof options == 'undefined' ) {
|
||||||
options = [];
|
options = [];
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue