()
| 20 | // ============================================================================= |
| 21 | |
| 22 | const makeTrafficLight = () => |
| 23 | createFsm({ |
| 24 | id: "traffic-light", |
| 25 | initialState: "green", |
| 26 | context: { ticks: 0 }, |
| 27 | states: { |
| 28 | green: { |
| 29 | timeout: "yellow" as const, |
| 30 | tick({ ctx }: any) { |
| 31 | ctx.ticks++; |
| 32 | }, |
| 33 | }, |
| 34 | yellow: { timeout: "red" as const }, |
| 35 | red: { timeout: "green" as const }, |
| 36 | }, |
| 37 | }); |
| 38 | |
| 39 | const makeCounter = () => |
| 40 | createFsm({ |
no test coverage detected