src/command/CommandManager.js
function register(name, id, commandFn) {
        if (_commands[id]) {
            console.log("Attempting to register an already-registered command: " + id);
            return null;
        }
        if (!name || !id || !commandFn) {
            console.error("Attempting to register a command with a missing name, id, or command function:" + name + " " + id);
            return null;
        }

        var command = new Command(name, id, commandFn);
        _commands[id] = command;

        exports.trigger("commandRegistered", command);

        return command;
    }
function register(name, id, commandFn) {
        if (_commands[id]) {
            console.log("Attempting to register an already-registered command: " + id);
            return null;
        }
        if (!name || !id || !commandFn) {
            console.error("Attempting to register a command with a missing name, id, or command function:" + name + " " + id);
            return null;
        }

        var command = new Command(name, id, commandFn);
        _commands[id] = command;

        exports.trigger("commandRegistered", command);

        return command;
    }
function register ( name , id , commandFn ) { if ( _commands [ id ] ) { console . log ( "Attempting to register an already-registered command: " + id ) ; return null ; } if ( ! name || ! id || ! commandFn ) { console . error ( "Attempting to register a command with a missing name, id, or command function:" + name + " " + id ) ; return null ; } var command = new Command ( name , id , commandFn ) ; _commands [ id ] = command ; exports . trigger ( "commandRegistered" , command ) ; return command ; }
Registers a global command.
@param {string} name - text that will be displayed in the UI to represent command
@param {string} id - unique identifier for command.
Core commands in Brackets use a simple command title as an id, for example "open.file".
Extensions should use the following format: "author.myextension.mycommandname".
For example, "lschmitt.csswizard.format.css".
@param {function(...)} commandFn - the function to call when the command is executed. Any arguments passed to
execute() (after the id) are passed as arguments to the function. If the function is asynchronous,
it must return a jQuery promise that is resolved when the command completes. Otherwise, the
CommandManager will assume it is synchronous, and return a promise that is already resolved.
@return {?Command}
Registers a global command .