Skip to content

Instantly share code, notes, and snippets.

@wighawag
Last active June 22, 2020 22:20
Show Gist options
  • Save wighawag/a00a551a6ea10ba630fdf22f474a32c6 to your computer and use it in GitHub Desktop.
Save wighawag/a00a551a6ea10ba630fdf22f474a32c6 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'planet',
initial: 'unknown',
on :{
PROBE: {
target: '.probing',
in: 'unknown',
},
RETRY: {
target: '.probing',
in: 'probing.error',
},
CANCEL: {
target: '.unknown',
in: 'probing',
},
},
states: {
unknown: {},
probing: {
entry: 'probe',
initial: 'start',
states: {
start: {
on: {
FOUND: '#found',
NOT_FOUND: '#notFound',
ERROR: 'error',
},
},
error: {},
}
},
found: {
id: 'found',
type: 'final',
},
notFound: {
id: 'notFound',
type: 'final',
},
}
},
{
actions: {
probe: () => {
console.log('probe');
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment