Created
July 13, 2021 14:38
-
-
Save jktravis/bc2611753f6ea21d117e10a2e719b73f 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'top', | |
initial: "clean", | |
states: { | |
clean: { | |
initial: 'loaded', | |
states: { | |
loaded: { | |
on: { | |
edit: { | |
target: '#top.dirty' | |
}, | |
search: { | |
target: 'searching', | |
} | |
}, | |
}, | |
searching: { | |
on: { | |
done: {target: 'loaded'}, | |
error: {target: 'loaded'}, | |
} | |
} | |
} | |
}, | |
dirty: { | |
initial: 'loaded', | |
states: { | |
loaded: { | |
on: { | |
save: { | |
target: '#top.clean' | |
}, | |
edit: { | |
target: 'loaded' | |
}, | |
search: { | |
target: 'searching', | |
}, | |
} | |
}, | |
searching: { | |
on: { | |
done: {target: 'loaded'}, | |
error: {target: 'loaded'}, | |
} | |
} | |
} | |
} | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment