Skip to content

Instantly share code, notes, and snippets.

@davidkpiano
Created June 7, 2020 01:17
Show Gist options
  • Save davidkpiano/3c9935be5bf8db7d600f6742df6a7ee9 to your computer and use it in GitHub Desktop.
Save davidkpiano/3c9935be5bf8db7d600f6742df6a7ee9 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const donutMachine = 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_DRY: 'mixed' }
},
mixed: {
type: 'final'
}
}
}
},
onDone: 'allMixed'
},
allMixed: {
type: 'final'
},
}
},
fry: {},
flip: {},
dry: {},
glaze: {},
serve: {}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment