File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
packages/node_modules/overmind/src Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,14 @@ export type Statemachine<States extends string> = {
1515}
1616
1717const CURRENT_EXIT = Symbol ( 'CURRENT_EXIT' )
18+ const INITIAL_STATE = Symbol ( 'INITIAL_STATE' )
1819
1920class StateMachine < States extends string > {
2021 current : States
2122 private [ CURRENT_EXIT ] : ( ( ) => void ) | undefined
23+ private [ INITIAL_STATE ] : States
2224 constructor ( definition : StatemachineDefinition < States > ) {
25+ this [ INITIAL_STATE ] = definition . initial
2326 this . current = definition . initial
2427
2528 Object . keys ( definition . states ) . reduce ( ( aggr , key ) => {
@@ -47,6 +50,7 @@ class StateMachine<States extends string> {
4750 exit ( )
4851 this [ VALUE ] [ CURRENT_EXIT ] = undefined
4952 }
53+ this . current = this [ INITIAL_STATE ]
5054 }
5155}
5256
You can’t perform that action at this time.
0 commit comments