Skip to content

Instantly share code, notes, and snippets.

@ooloth
Created September 24, 2019 18:16
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 ooloth/9e8f5726c30cb7ee7971e049b0fa0d0d to your computer and use it in GitHub Desktop.
Save ooloth/9e8f5726c30cb7ee7971e049b0fa0d0d 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 machine = Machine({
id: 'cart',
initial: 'closed',
states: {
closed: {
on: {
OPEN: 'open',
},
},
open: {
initial: 'pending',
on: {
CLOSE: 'closed',
},
states: {
// I am trying to think around the checkout
// The product interactions are also going to be async but
// I don't think they are not states of the cart. More like actions
pending: {
on: {
RESOLVE: 'resolved',
REJECT: 'rejected'
},
},
resolved: {
type: 'final',
},
rejected: {
type: 'final',
}
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment