Last active
November 17, 2020 22:39
-
-
Save tomByrer/388bb0b808b8a69b1bfd24ad6125e4e6 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
// watch console for output | |
// to help visualize Action Order | |
// https://xstate.js.org/docs/guides/actions.html#action-order | |
const watchActions = Machine({ | |
id: 'actionLoop', | |
initial: 'ready', | |
states: { | |
ready: { | |
entry: 'logReadyEntry', | |
on: { | |
CLICK: { | |
target: 'select', | |
}, | |
}, | |
}, | |
select: { | |
entry: 'logSelEntry', | |
exit: 'logSelExit', | |
on: { | |
CLICK: { | |
target: 'ready', | |
actions: 'logSelClick', | |
}, | |
}, | |
}, | |
} | |
}, | |
{ | |
actions: { | |
logReadyEntry: ()=>{ | |
console.log('ready entry,') | |
}, | |
logSelEntry: ()=>{ | |
console.log('select entry,') | |
}, | |
logSelClick: ()=>{ | |
console.log('select-CLICK!') | |
}, | |
logSelExit: ()=>{ | |
console.log('exit select soon...') | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment