Skip to content

Instantly share code, notes, and snippets.

@steam
Created March 25, 2021 22:12
Show Gist options
  • Save steam/304145f45656f820d1eebe7d46bc7241 to your computer and use it in GitHub Desktop.
Save steam/304145f45656f820d1eebe7d46bc7241 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// 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', in: '#steps.need_by.started'} },
},
started: {
on: { COMPLETE: 'completed' },
},
completed: {},
},
},
hist: {
type: 'history',
history: 'deep',
},
},
}, { guards: {needByStarted: (context) => false}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment