Files
smartstate/ts/smartstate.classes.stateaction.ts
Juergen Kunz a47d8bb3c7
Some checks failed
Default (tags) / security (push) Failing after 27s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
fix(smartstate): Fix StateAction trigger method to properly return Promise
2025-07-19 07:18:53 +00:00

21 lines
650 B
TypeScript

import * as plugins from './smartstate.plugins.js';
import { StatePart } from './smartstate.classes.statepart.js';
export interface IActionDef<TStateType, TActionPayloadType> {
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;
}
/**
* an actionmodifier for the state
*/
export class StateAction<TStateType, TActionPayloadType> {
constructor(
public statePartRef: StatePart<any, any>,
public actionDef: IActionDef<TStateType, TActionPayloadType>
) {}
public trigger(payload: TActionPayloadType): Promise<TStateType> {
return this.statePartRef.dispatchAction(this, payload);
}
}