Last active
June 22, 2020 22:32
-
-
Save wighawag/7cbe416870e9d0fd1d9bc6808605d957 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
Machine({ | |
id: 'planet', | |
initial: 'idle', | |
context: { | |
error: undefined | |
}, | |
on: { | |
PROBE: { | |
target: '.probing', | |
in: 'idle', | |
actions: 'reset_error', | |
}, | |
CANCEL: { | |
target: '.idle', | |
in: 'probing', | |
}, | |
ACKNOWLEDGE_ERROR: { | |
target: '', | |
actions: 'reset_error', | |
cond: 'has_error', | |
} | |
}, | |
states: { | |
idle: {}, | |
probing: { | |
on:{ | |
FOUND: 'found', | |
NOT_FOUND: 'notFound', | |
ERROR: { | |
target: 'idle', | |
actions: 'error_probing' | |
} | |
}, | |
}, | |
found: { | |
type: 'final', | |
}, | |
notFound: { | |
type: 'final', | |
}, | |
} | |
}, | |
{ | |
guards: { | |
has_error: (context) => context.error !== undefined, | |
}, | |
actions: { | |
error_probing: assign({ | |
error: 'error probing', | |
}), | |
reset_error: assign({ | |
error: undefined, | |
}), | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment