class SagaInstance
The data for a single execution of a Saga
Sagas are stateful concepts, and this type contains the state.
Properties
Methods
endSaga(preserveInstanceData)
Name | Type | Description |
---|---|---|
|
|
|
Returns |
|
Signature
endSaga(preserveInstanceData?: boolean): void;
get(name)
Get a piece of arbitrary data from the saga instance
Name | Type | Description |
---|---|---|
|
|
THe key |
Returns |
|
Signature
get<K extends keyof T>(name: K): T[K];
removeTimer(name)
Name | Type | Description |
---|---|---|
|
|
|
Returns |
|
Signature
removeTimer(name: TimeoutNames): void;
set(name, value)
Set a piece of arbitrary data into the saga instance
Name | Type | Description |
---|---|---|
|
|
The key |
|
|
the value. Must be able to encode to JSON. |
Returns |
|
Signature
set(name: keyof T, value: any): void;
upsertTimer(name, config)
Create (or overwrite) a timer to call. Can be either a simple timer (millis to wait), or a cron timer.
If the timer is no longer wanted, it must be removed by calling
Name | Type | Description |
---|---|---|
|
|
The timer to call |
|
|
|
Returns |
|
Signature
upsertTimer(name: TimeoutNames, config: {
isCron: true;
crontab: string;
} | {
isCron: false;
timeout: number;
}): void;