Class: Command

RS~Command

The Command class that wraps the information needed to execute a command. It consists of the command and and object containing it's parameters.

Commands are executed either directly on the Service via RS.Service#send_command, RS.Service#execute_command or in a RS.CommandQueue obtained from RS.Service#queue_commands.

new Command (name, parameters)

Creates a new Command. Takes a name and a set of parameters. Typically once constructed commands are not modified.

Note: Command parameters should consist of the following JavaScript types only:

  • String
  • Number
  • Boolean
  • Null
  • Undefined
  • Array
  • ArrayBuffer

Any other type provided will be interpreted as an Object and have it's enumerable properties sent in a Map using Object.keys(value).forEach().

This means if you are using some form of framework that modifies or extends core JavaScript types, EG: MobX or Immutable.js, you need to ensure you convert these to native JavaScript types before passing them as command parameters.

Name Type Description
name String

the command name to execute.

parameters Object

the command parameters.

Example
let c = new Command('import_scene',
             {
                 scene_name:'meyemii',
                 block:true,
                 filename: 'scenes/meyemii.mi'
             });
c = new Command('render',
             {
                 scene_name:'meyemii',
                 renderer:'iray',
                 format: 'png',
                 render_context_options: {
                     scheduler_mode: {
                         value: 'batch',
                         type: 'String'
                     }
                 }
             });

Members

name String

The command name

params Object

The command parameters. Object keys are the parameter names and values are their values.