Class: Command_queue

RS.Command_queue

The Command_queue class queues up an array of commands to be executed as a batch.

NOTE: Users do not create Command_queues directly but by calling RS.Service#queue_commands or RS.Stream#queue_commands.

Members

length

The length of the current command queue.

Methods

execute ()Promise

Sends the command queue for execution and returns a Promise that will resolve to an iterable containing the results of all commands whose want_response argument was true. On command error they will resolve with a RS.Command_error. If the queue was created with wait_for_render set to true (see RS.Stream#queue_commands) then the last iterable will contain the first rendered image that contains the results of the commands as a RS.Stream~Rendered_image.

The promise will reject in the following circumstances:

  • there is no WebSocket connection.
  • the WebSocket connection has not started (IE: RS.Service#connect has not yet resolved).
Fires:
Returns:
Type Description
Promise

queue (command, want_response)

Adds a command to the command queue.

Name Type Default Description
command Command

The command to add.

want_response Boolean false optional

Whether we want a response from this command or not

send ()Array.<Promise>

Sends the command queue for execution and returns an array of promises that will resolve to the results of all commands whose want_response argument was true. On command error they will resolve with a RS.Command_error. If the queue was created with wait_for_render set to true (see RS.Stream#queue_commands) then there will be an additional Promise at the end of the array that will resolve with a RS.Stream~Rendered_result just before the RS.Stream#event:image event that contains the result of this command is emitted.

Fires:
Throws:

This call will throw an error in the following circumstances:

  • there is no WebSocket connection.
  • the WebSocket connection has not started (IE: RS.Service#connect has not yet resolved).
Type
RS.Error
Returns:
Type Description
Array.<Promise> An Array of Promises.