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

Function makeCounter

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

Source from the content-addressed store, hash-verified

37 });
38
39const 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
60const makeAlwaysValid = () =>
61 createFsm({

Callers 1

walk.test.tsFile · 0.85

Calls 1

createFsmFunction · 0.90

Tested by

no test coverage detected