Skip to content

Instantly share code, notes, and snippets.

@justinmoon
Created March 3, 2020 17:50
Show Gist options
  • Save justinmoon/81e9dee651a9afd3d039f3eccee088c6 to your computer and use it in GitHub Desktop.
Save justinmoon/81e9dee651a9afd3d039f3eccee088c6 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: "account",
initial: "initializing",
context: {
account: {}
},
states: {
ready: {},
initializing: {
invoke: {
src: "init",
onDone: {
target: "ready",
actions: "cache"
},
onError: {
target: "ready",
actions: "onError"
}
}
}
}, services: {
init: (ctx, evt) => {
console.log('TODO: load wallet on bitcoin node')
}
},
actions: {
onDone: (ctx, evt) => {
console.log('there was no error', evt)
},
onError: (ctx, evt) => {
console.log('there was an error', evt)
}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment