Last active
March 25, 2021 22:04
-
-
Save steam/25a0673cc75aba33b9b2e55951084fd6 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) | |
const stepsMachine = Machine({ | |
id: 'steps', | |
initial: 'need_by', | |
type: 'parallel', | |
states: { | |
need_by: { | |
initial: 'unstarted', | |
on: { NEXT: 'contact_info' }, | |
states: { | |
unstarted: { | |
on: { START: 'started' }, | |
}, | |
started: { | |
on: { COMPLETE: 'completed' }, | |
}, | |
completed: {}, | |
}, | |
}, | |
contact_info: { | |
on: { PREV: 'need_by' }, | |
initial: 'unstarted', | |
states: { | |
unstarted: { | |
on: { START: {target: 'started', cond: 'needByStarted'} }, | |
}, | |
started: { | |
on: { COMPLETE: 'completed' }, | |
}, | |
completed: {}, | |
}, | |
}, | |
hist: { | |
type: 'history', | |
history: 'deep', | |
}, | |
}, | |
}, { guards: {needByStarted: (ctx) => false}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment