Created
January 13, 2022 02:07
-
-
Save maxam2017/9cb8ecfa5cec906f1f5557458205d39e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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