Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active November 17, 2020 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomByrer/388bb0b808b8a69b1bfd24ad6125e4e6 to your computer and use it in GitHub Desktop.
Save tomByrer/388bb0b808b8a69b1bfd24ad6125e4e6 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// 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