begin typescript types
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { Machine, State, On, Do, Goto, Spawn, Unspawn } from '../index';
|
||||
|
||||
const beginTimer = ()=>{};
|
||||
|
||||
type S = 'green' | 'yellow' | 'red';
|
||||
type E = 'entry' | 'timer-finished';
|
||||
|
||||
const machine =
|
||||
Machine(
|
||||
State('green',
|
||||
On('entry',
|
||||
Do(beginTimer)
|
||||
),
|
||||
On('timer-finished',
|
||||
Goto('yellow')
|
||||
)
|
||||
),
|
||||
State('yellow',
|
||||
On('entry',
|
||||
Do(beginTimer)
|
||||
),
|
||||
On('timer-finished',
|
||||
Goto('red')
|
||||
)
|
||||
),
|
||||
State('red',
|
||||
On('entry',
|
||||
Do(beginTimer)
|
||||
),
|
||||
On('timer-finished',
|
||||
Goto('green')
|
||||
)
|
||||
),
|
||||
);
|
||||
Reference in New Issue
Block a user