impl basic player state machine (#198)

This commit is contained in:
yz-yu
2026-04-01 12:00:00 +08:00
committed by GitHub
parent a7d857c9e4
commit bfc0c43aa7
5 changed files with 206 additions and 18 deletions

22
src/declarations/@xstate/fsm/index.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
import * as fsm from '@xstate/fsm';
declare module '@xstate/fsm' {
export namespace StateMachine {
interface Service<
TContext extends object,
TEvent extends fsm.EventObject,
TState extends fsm.Typestate<TContext> = any
> {
send: (event: TEvent | TEvent['type']) => void;
subscribe: (
listener: StateListener<State<TContext, TEvent, TState>>,
) => {
unsubscribe: () => void;
};
start: () => Service<TContext, TEvent, TState>;
stop: () => Service<TContext, TEvent, TState>;
readonly status: fsm.InterpreterStatus;
readonly state: State<TContext, TEvent, TState>;
}
}
}