Skip to content

Instantly share code, notes, and snippets.

@saadshahd
Created September 30, 2020 13:22
Show Gist options
  • Save saadshahd/d16ebf0b7acf23781aca85fe19edf4e6 to your computer and use it in GitHub Desktop.
Save saadshahd/d16ebf0b7acf23781aca85fe19edf4e6 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: 'NotImported',
context: {
retries: 0
},
states: {
NotImported: {
on: {
SBD_IMPORT_START: 'Processing',
},
},
Processing: {
on: {
SBD_IMPORT_SUCCESS: 'Available',
SBD_IMPORT_FAILED: 'Failed',
},
},
Failed: {
on: {
SBD_IMPORT_START: 'Processing',
},
},
Available: {
on: {
SBD_IMPORT_START: 'Updating',
},
},
Updating: {
on: {
SBD_IMPORT_SUCCESS: 'Updated',
SBD_IMPORT_FAILED: 'FailedUpdate',
},
},
Updated: {
on: {
SBD_IMPORT_START: 'Updating',
},
},
FailedUpdate: {
on: {
SBD_IMPORT_START: 'Updating',
},
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment