Skip to content

Instantly share code, notes, and snippets.

@simmo
Created July 14, 2020 22:05
Show Gist options
  • Save simmo/7a0312c690f898a7023d4712c8ee26ce to your computer and use it in GitHub Desktop.
Save simmo/7a0312c690f898a7023d4712c8ee26ce 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 fetchMachine = Machine({
id: 'e-comm',
initial: 'landing',
states: {
landing: {
on: {
NEXT: 'hasMotorSkills'
}
},
hasMotorSkills: {
on: {
RESET: 'landing',
PREV: 'landing',
NEXT: 'canSitWithoutAssistance'
}
},
canSitWithoutAssistance: {
on: {
RESET: 'landing',
PREV: 'hasMotorSkills',
NEXT: 'pickType',
}
},
pickType: {
on: {
RESET: 'landing',
PREV: 'canSitWithoutAssistance',
NEXT: 'pickChair',
}
},
pickChair: {
on: {
RESET: 'landing',
PREV: 'pickType',
NEXT: 'payment',
}
},
payment: {
on: {
CANCEL: 'landing',
FAIL: 'paymentFailed',
SUCCESS: 'complete',
}
},
paymentFailed: {
on: {
CANCEL: 'landing',
RETRY: 'payment',
}
},
complete: {},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment