Created
July 27, 2021 10:00
-
-
Save chenxeed/ac3002e0b81a67fdf6eeff67cab9d4d1 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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: '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