Skip to content

Instantly share code, notes, and snippets.

@jimmyhzhang
Created September 26, 2019 18:57
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 jimmyhzhang/41ba75c0fe46946dfc64a7864e930fbe to your computer and use it in GitHub Desktop.
Save jimmyhzhang/41ba75c0fe46946dfc64a7864e930fbe 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: 'command',
initial: 'notStarted',
context: {
retries: 0
},
states: {
notStarted: {
on: {
REQUESTED_EXECUTION: 'executingCommand',
REQUESTED_CANCELLATION: 'cancelled'
}
},
executingCommand: {
on: {
EXECUTION_SUCCEEDED: 'completed',
EXECUTION_FAILED: 'completed',
REQUESTED_STATE_CHECK: 'waitingForStateCheck',
REQUESTED_CANCELLATION: 'cancelled'
}
},
completed: {
type: 'final'
},
cancelled: {},
waitingForStateCheck: {
on: {
STATE_CHECK_SUCCEEDED: 'completed',
STATE_CHECK_FAILED: 'completed',
REQUESTED_CANCELLATION: 'cancelled'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment