Created
December 3, 2020 06:47
-
-
Save ufo2mstar/9096c7756beeb49c2d797c15159029cb 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
const scriptMachine = Machine({ | |
id: 'fetch', | |
initial: 'NO_SCRIPTS', | |
context: { | |
retries: 0, | |
}, | |
states: { | |
NO_SCRIPTS: { on: { loadScript: 'SCRIPT_LOADING' } }, | |
SCRIPT_LOADING: { on: { loadedScript: 'SCRIPT_READY', loadFailed: 'NO_SCRIPTS' } }, | |
SCRIPT_READY: { | |
on: { | |
editing: 'SCRIPT_READY', | |
loadExample: 'SCRIPT_LOADING_INPUT', | |
loadSchema: 'SCRIPT_LOADING_SCHEMA', | |
clear: 'SCRIPT_LOADING_RESET', | |
runScript: 'SCRIPT_RUNNING' | |
}, | |
}, | |
SCRIPT_ERROR: { on: { showError: 'SCRIPT_READY' } }, | |
SCRIPT_LOADING_INPUT: { on: { loadedExample: 'SCRIPT_READY', loadFailed: 'SCRIPT_ERROR' } }, | |
SCRIPT_LOADING_SCHEMA: { on: { loadedSchema: 'SCRIPT_READY', loadFailed: 'SCRIPT_ERROR' } }, | |
SCRIPT_LOADING_RESET: { on: { succesfulClear: 'SCRIPT_READY' } }, | |
SCRIPT_RUNNING: { on: { successfulRun: 'SCRIPT_RESULT_READY', failedRun: 'SCRIPT_ERROR' } }, | |
SCRIPT_RESULT_READY: { type: 'final' }, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment