Skip to content

Instantly share code, notes, and snippets.

@edorivai
Last active June 26, 2020 08:18
Show Gist options
  • Save edorivai/bf5232099ee2bd6b86c273b40d4b6063 to your computer and use it in GitHub Desktop.
Save edorivai/bf5232099ee2bd6b86c273b40d4b6063 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: 'device-update',
initial: 'idle',
context: {
},
states: {
idle: {
on: {
SET_TARGET_VERSION: 'updating'
}
},
updating: {
on: {
DEPLOY_TIMED_OUT: 'updateFailed.updateTimedOut',
},
initial: 'updateStarting',
states: {
updateStarting: {
on: {
COMPLETE: 'updateRunning',
DEPLOY_FAILED: '#device-update.updateFailed.updateFailedToStart',
}
},
updateRunning: {
on: {
COMPLETE: '#device-update.idle',
}
}
}
},
updateFailed: {
initial: 'updateFailedToStart',
states: {
updateFailedToStart: {
},
updateTimedOut: {
}
},
on: {
RETRY: 'updating',
SET_TARGET_VERSION: 'updating'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment