Class: Command<S>
Type parameters
| Name | Type |
|---|---|
S | extends State = State |
Hierarchy
Command↳
GameOver↳
Noop↳
Select↳
Deselect↳
Sequence↳
FaceUp↳
FaceDown↳
Flip↳
RevealUI↳
HideUI↳
Wait↳
Undo
Implements
ICommand<S>
Constructors
constructor
• new Command<S>(name?)
Type parameters
| Name | Type |
|---|---|
S | extends State<Record<string, unknown>, S> = State<Record<string, unknown>> |
Parameters
| Name | Type | Description |
|---|---|---|
name? | string | provide only if you're using new Command() syntax. If you're extending command, just leave it empty - the name will be grabbed from class name. |
Accessors
name
• get name(): string
Returns
string
Methods
execute
▸ execute(state, room): Promise<void>
Parameters
| Name | Type |
|---|---|
state | S |
room | Room<S, Record<string, unknown>> |
Returns
Promise<void>
Implementation of
subExecute
▸ Protected subExecute(state, room, command): Promise<void>
Execute a sub command.
Call ONLY during your commands execute method.
Will also remember it internally for undoing.
Parameters
| Name | Type |
|---|---|
state | S |
room | Room<S, Record<string, unknown>> |
command | Command<S> |
Returns
Promise<void>
undo
▸ undo(state, room): Promise<void>
Undoes every remembered extra sub command.
Command may gather new sub commands only while executing.
Sequence will only gather sub commands upon construction.
Parameters
| Name | Type |
|---|---|
state | S |
room | Room<any, Record<string, unknown>> |
Returns
Promise<void>