Skip to content

Instantly share code, notes, and snippets.

@tivac
Created July 8, 2020 21:06
Show Gist options
  • Save tivac/4c811f6ceac6d1ffad21badde3f6d3a8 to your computer and use it in GitHub Desktop.
Save tivac/4c811f6ceac6d1ffad21badde3f6d3a8 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: 'invoke-event',
initial: 'idle',
context: {
foo: 0
},
states: {
idle: {
exit : assign({
exit : (ctx, { data }) => data,
}),
invoke : {
id : "invoke",
src : () => Promise.resolve("data"),
onDone : {
target : "done",
actions : assign({
ondone : (ctx, { data }) => data,
}),
},
},
},
done: {
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment