Class State<TData, TOptions>

Execution state management.

The State is responsible for managing the state of command execution. It provides mechanisms to progress through command execution, handle state transitions, and manage the lifecycle of command data.

Type Parameters

Accessors

  • get i(): number
  • The current step index.

    Returns number

Constructors

Methods

  • Return data and end the steps.

    Parameters

    • Optional data: unknown

      The data to return.

    Returns Promise<void>

  • Modify the data and continue to the next step if there is one, otherwise return the data.

    Parameters

    • Optional data: unknown

      The data to pass to the next step or return.

    Returns Promise<void>

  • Start the steps.

    Parameters

    • Optional initialData: unknown

    Returns Promise<void>

    A promise that resolves when the steps are done.

    Throws

    If the steps have already started.