Created
September 24, 2019 18:16
-
-
Save ooloth/9e8f5726c30cb7ee7971e049b0fa0d0d 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 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