MCPcopy
hub / github.com/ifandelse/machina.js / makeTrafficLight

Function makeTrafficLight

packages/machina-test/src/walk.test.ts:22–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20// =============================================================================
21
22const 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
39const makeCounter = () =>
40 createFsm({

Callers 2

walk.test.tsFile · 0.70
recordFunction · 0.70

Calls 1

createFsmFunction · 0.90

Tested by

no test coverage detected