Skip to content

Instantly share code, notes, and snippets.

@maxam2017
Created January 13, 2022 02:07
Show Gist options
  • Save maxam2017/9cb8ecfa5cec906f1f5557458205d39e to your computer and use it in GitHub Desktop.
Save maxam2017/9cb8ecfa5cec906f1f5557458205d39e 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 shoppingMachine = Machine({
id: 'shopping',
initial: 'browsing',
context: {
},
states: {
browsing: {
on: {
ADD_TO_CART: 'browsing',
DIRECTLY_BUY: 'cart',
}
},
cart: {
on: {
UPDATE_CART: 'cart',
FILL_ORDER: 'order'
}
},
order: {
// get member info
CHOOSE_DILIVERY: 'order',
CHECK_OUT: 'checkout'
},
checkout: {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment