Skip to content

Instantly share code, notes, and snippets.

@cellog
Created May 5, 2020 14:46
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 cellog/005f77bdf20d836525f4856ec81a0458 to your computer and use it in GitHub Desktop.
Save cellog/005f77bdf20d836525f4856ec81a0458 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: 'fetch',
initial: 'loading',
context: {
retries: 0
},
states: {
loading: {
type: "parallel",
states: {
workflowPredictor: {
initial: "loadWorkflow",
states: {
loadWorkflow: {
on: {
LOADED: "loadPredictor",
ERROR: "#fetch.failure",
}
},
loadPredictor: {
on: {
LOADED: "done",
ERROR: "#fetch.failure"
}
},
done: {
type: "final",
}
}
},
execution: {
initial: "loading",
states: {
loading: {
on: {
DONE: "done",
ERROR: "#fetch.failure",
}
},
done: {
type: "final",
}
}
}
},
onDone: "success"
},
success: {
type: 'final'
},
failure: {
type: "final"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment