Created
December 5, 2020 10:27
-
-
Save zushenyan/f148106b7144a1317dc084dcbaf577bf 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 machine = Machine({ | |
initial: 'ready', | |
on: { | |
TYPE: { | |
target: 'startSearching', | |
actions: ['setKeyword'], | |
}, | |
SEARCH: 'searching', | |
ERROR: 'error', | |
}, | |
states: { | |
ready: {}, | |
startSearching: { | |
entry: ['cancelDebouncedSearch', 'debouncedSearch'], | |
}, | |
searching: { | |
invoke: { | |
id: 'searchAll', | |
src: 'searchAll', | |
onDone: { | |
target: 'ready', | |
actions: 'setData', | |
}, | |
onError: 'error', | |
}, | |
}, | |
error: { | |
after: { | |
3000: 'searching', | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment