Class: Kickstarter

Kickstarter

Creates a new instance of the Controller class. This controller object has an object of type CommandContext, that will be passed into the command object when the controller executes the command. The kickstarter can run a macro command or a single command. Both command types will return a promise.

Constructor

new Kickstarter(action, action)

Creates an instance of the controller class and passes the value of the action parameter to the context.
The kickstarter can run in three different modes.
 Single command mode: 
     -The action parameter must be the name of the command,
      without the .js file extension, so like this: .
     -Namespaces are allowed and must be included, like this:
          .
 
 Macro command mode:
     -The action parameter must be the id of the macro,
      as specified in the user configuration file.
     -Namespaces are allowed and can be used in two ways:
         1)  When all subcommands are in the same namespace,
             specify a namespace, by putting a namespace key
             into the macro configuration like this:
                 <"namespace": "my/namespace/mycommand">
         2)  When subcommands have different namespaces,
             set the namespace key to 'false' like this:
                 <"namespace": false> 
             or remove it completely. Then set the namespace
             for each subcommand individually in the cmdSequence
             key like this:
                 

 Test mode:
      - if the action parameter is set to 'testMode', then 
         the helper.modConfig() will load the configuration for the test environment.
       - the environment is located in the 'test'-directory: ./test/testEnv' 
The constructor also reads the module configuration file, in which the following relative paths must be specified:
 {
   "userCommandsRootDir":"my/project/commands",
   "userConfigFile":"my/project/config/config.json",
   "userHelperDir":"my/project/helper"
 }
Parameters:
Name Type Description
action string The name of a single command.
action number The id of a macro (available in the user configuration file).
Properties:
Name Type Description
this.ctrl Controller A new controller object.
this.ctxt commandContext The commandContext object that comes with a new controller.
Author:
  • ruckola
Source:

Methods

run() → {Promise}

Delegates the execution of the command to the controller.
Source:
Returns:
- a promise with a commandResult object as its value.
If you run a macro with multiple subcommands, the commandResult object of each subcommand,
will be included in the array of the 'data'-property. (See also: CommandResult)

Note: This nesting of commandResult objects can go very deep, since it is possible to spawn kickstarters (read: start other macro's) from subcommands as well.
By doing this, you will allow to run some commands asynchronous in relation to each other, but still your client can depend upon the output.
This is because everything finally resolves into just one promise, that will be returned to the client.
Type
Promise