Skip to content

Run multiple commands at the same timeΒ #3

@oskarer

Description

@oskarer

First of all, thank you for this library! It has been a blast so far πŸ₯‡

I have a use case where I want to dispatch two (or more) commands after a command finished. They're all promises.

Example;

export class OnJoinCommand extends Command<YourState, { sessionId: string }> {
  execute({ sessionId }) {
    this.state.players[sessionId] = new Player();
    return [
      new FirstCommand().setPayload({ sessionId }),
      new SecondCommand().setPayload({ sessionId })
    ];
  }
}

In that case SecondCommand would execute after FirstCommand finished, how would I execute both at the same time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions