Skip to content

Instantly share code, notes, and snippets.

@davidkpiano
Created October 12, 2020 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidkpiano/529435f997b4276799778db37f64b0da to your computer and use it in GitHub Desktop.
Save davidkpiano/529435f997b4276799778db37f64b0da to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'donut',
initial: 'ingredients',
states: {
ingredients: {
on: {
NEXT: 'directions',
},
},
directions: {
initial: 'makeDough',
onDone: 'fry',
states: {
makeDough: {
on: { NEXT: 'mix' },
},
mix: {
type: 'parallel',
states: {
mixDry: {
initial: 'mixing',
states: {
mixing: {
on: { MIXED_DRY: 'mixed' },
},
mixed: {
type: 'final',
},
},
},
mixWet: {
initial: 'mixing',
states: {
mixing: {
on: { MIXED_WET: 'mixed' },
},
mixed: {
type: 'final',
},
},
},
},
onDone: 'allMixed',
},
allMixed: {
type: 'final',
},
},
},
fry: {
on: {
NEXT: 'flip',
},
},
flip: {
on: {
NEXT: 'dry',
},
},
dry: {
on: {
NEXT: 'glaze',
},
},
glaze: {
on: {
NEXT: 'serve',
},
},
serve: {
on: {
ANOTHER_DONUT: 'ingredients',
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment