Last active
April 24, 2021 19:51
-
-
Save cryppadotta/408dd7beb6bcf60222d44fe6db671a7c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
// add, compound, harvest, exit | |
// are all things to calculate on evaluation loops, they're not so much "state" | |
const poolMachine = { | |
id: 'pool', | |
initial: 'unknown', | |
states: { | |
unknown: { | |
on: { | |
ELIGIBLE: 'eligible', | |
ARCHIVE: 'archived', | |
INSPECT: 'inspect' | |
} | |
}, | |
eligible: { | |
on: { | |
ARCHIVE: 'archived' | |
} | |
}, | |
inspect: { | |
on: { | |
REVISIT: 'unknown' | |
} | |
}, | |
archived: { | |
on: { | |
REVISIT: 'unknown' | |
} | |
} | |
} | |
} | |
const farmMachine = Machine({ | |
id: 'farm', | |
initial: 'unknown', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
unknown: { | |
on: { | |
CAN_READ: 'readable', | |
CANT_READ: 'inspect' | |
} | |
}, | |
readable: { | |
on: { | |
CAN_FARM: 'farmable', | |
CANT_FARM: 'inspect' | |
} | |
}, | |
farmable: { | |
on: { | |
DUSTBOWL: 'archived' | |
}, | |
...poolMachine | |
}, | |
inspect: { | |
on: { | |
FIXED: 'unknown', | |
WONTFIX: 'archived' | |
} | |
}, | |
archived: { | |
on: { | |
REVISIT: 'unknown' | |
} | |
}, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment