Skip to content

Instantly share code, notes, and snippets.

@chenxeed
Created July 27, 2021 10:00
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/ac3002e0b81a67fdf6eeff67cab9d4d1 to your computer and use it in GitHub Desktop.
Save chenxeed/ac3002e0b81a67fdf6eeff67cab9d4d1 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: {
START: {
target: 'downloading',
actions: ['startDownload']
}
}
},
downloading: {
on: {
SUCCESS: {
target: 'download-success'
},
FAIL: {
target: 'download-fail'
},
CANCEL: {
target: 'idle',
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