Skip to content

Instantly share code, notes, and snippets.

@chenxeed
Last active July 28, 2021 03:32
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 chenxeed/814afad1192590ec4bd9b9355726ae71 to your computer and use it in GitHub Desktop.
Save chenxeed/814afad1192590ec4bd9b9355726ae71 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: 'popoverDownload',
context: {
downloadCue: 0
},
initial: 'idle',
states: {
idle: {
on: {
OPEN: {
target: 'show-download'
}
}
},
'show-download': {
on: {
START: {
target: 'downloading',
actions: ['startDownload']
}
}
},
downloading: {
on: {
SUCCESS: {
target: 'download-success'
},
FAIL: {
target: 'download-fail'
},
CANCEL: {
target: 'show-download',
actions: ['cancelDownload']
}
}
},
'download-success': {
on: {
END: {
target: 'idle'
}
}
},
'download-fail': {
on: {
END: {
target: 'idle'
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment