Skip to content

4.1.0

Compare
Choose a tag to compare
@bdwain bdwain released this 30 Sep 03:44
· 106 commits to master since this release

Cmd.list

Cmd.list is a new Cmd type that replaces Cmd.batch and Cmd.sequence and exposes new behavior. Batch and Sequence will remain in the API (with a deprecation warning) until v5, and then they will be removed.

The usage of Cmd.list is similar to both batch and sequence. Its signature is Cmd.list(cmds, options). Cmds is still just an array of other Cmds. Options currently has 2 optional properties.

  • sequence: a boolean that determines whether asynchronous Cmds run in parallel or one after the other. By default, this is false.
  • batch: a boolean that determines whether each action from a nested Cmd is dispatched as soon as that Cmd is done processing or all at once (in the original Cmd order) after everything is done. By default, this is false.

To mimic the behavior of Cmd.batch(cmds) with a list, you would say Cmd.list(cmds, {batch: true, sequence: false}).

To mimic the behavior of Cmd.sequence(cmds) with a list, you would say Cmd.list(cmds, {batch: true, sequence: true}).

Since batching actions delays updates to the app and gives the appearance of worse performance, it is recommended to only use it when needed. The same applies to running them in sequence instead of parallel (the default).