Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Last active July 13, 2020 10:52
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 JamieMason/446eb971c2c1dc3b9e55043e72e97f22 to your computer and use it in GitHub Desktop.
Save JamieMason/446eb971c2c1dc3b9e55043e72e97f22 to your computer and use it in GitHub Desktop.
checkoutMachine: Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const checkoutMachine = Machine(
{
id: "checkout",
initial: "validating",
context: {},
states: {
// validate the inital props and
// decide whether it's safe to
// start up or whether to bail
validating: {
on: {
"": [
{
cond: "hasError",
target: "broken",
},
{ target: "started" },
],
},
},
broken: {},
started: {
type: "parallel",
states: {
a: {}
},
},
},
},
{
guards: {
hasError: (ctx, event) => false
},
actions: {},
services: {},
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment