Skip to content

Instantly share code, notes, and snippets.

@lynxtaa
Last active February 10, 2021 08:50
Show Gist options
  • Save lynxtaa/bbb2bfdc4ad3c6e9797d1a7701c9d4ca to your computer and use it in GitHub Desktop.
Save lynxtaa/bbb2bfdc4ad3c6e9797d1a7701c9d4ca 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 fetchMachine = Machine({
id: 'route',
initial: 'node1',
states: {
node1: {
on: {
FORWARD: 'node2',
},
},
node2: {
on: {
FORWARD: 'subRoute1',
BACK: 'node1',
},
},
subRoute1: {
type: 'parallel',
states: {
branch1: {
initial: 'node3',
states: {
node3: {
on: {
FORWARD1: 'end',
},
},
end: { type: 'final' },
},
},
branch2: {
initial: 'node4',
states: {
node4: {
on: {
FORWARD2: 'node5',
},
},
node5: {
on: {
FORWARD2: 'end',
BACK2: 'node4',
},
},
end: { type: 'final' },
},
},
},
onDone: 'node6',
},
node6: {
on: {
BACK: { target: ['subRoute1.branch1.node3', 'subRoute1.branch2.node5'] },
FORWARD: 'node7',
},
},
node7: { type: 'final' },
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment