Last active
June 26, 2020 08:18
-
-
Save edorivai/bf5232099ee2bd6b86c273b40d4b6063 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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