Skip to content

Instantly share code, notes, and snippets.

@neonphog
Created August 7, 2019 22:13
Show Gist options
  • Select an option

  • Save neonphog/87b054dd51d85a28ec417bf00da631cd to your computer and use it in GitHub Desktop.

Select an option

Save neonphog/87b054dd51d85a28ec417bf00da631cd 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: 'network',
type: 'parallel',
on: {
BIND: {
target: [
'.core.bind.waitBind',
'.p2p.bind.waiting'
]
}
},
states: {
core: {
type: 'parallel',
states: {
bind: {
initial: 'done',
states: {
waitBind: {},
waitConnected: {
id: 'core.waitConnected',
on: { RESP: 'done' }
},
done: { type: 'final' }
}
}
}
},
p2p: {
type: 'parallel',
states: {
bind: {
initial: 'done',
states: {
waiting: {
id: 'p2p.waiting',
on: { BOUND: 'done' }
},
done: {
type: 'final',
on: {
null: '#core.waitConnected'
}
}
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment