()
| 37 | }); |
| 38 | |
| 39 | const makeCounter = () => |
| 40 | createFsm({ |
| 41 | id: "counter", |
| 42 | initialState: "idle", |
| 43 | context: { count: 0 }, |
| 44 | states: { |
| 45 | idle: { |
| 46 | start: "counting" as const, |
| 47 | reset({ ctx }: any) { |
| 48 | ctx.count = 0; |
| 49 | }, |
| 50 | }, |
| 51 | counting: { |
| 52 | increment({ ctx }: any) { |
| 53 | ctx.count++; |
| 54 | }, |
| 55 | stop: "idle" as const, |
| 56 | }, |
| 57 | }, |
| 58 | }); |
| 59 | |
| 60 | const makeAlwaysValid = () => |
| 61 | createFsm({ |