Skip to content

Instantly share code, notes, and snippets.

@LostKobrakai
Last active April 30, 2021 09:46
Show Gist options
  • Save LostKobrakai/249f2cc6395b06c04d4b3ee219ce8483 to your computer and use it in GitHub Desktop.
Save LostKobrakai/249f2cc6395b06c04d4b3ee219ce8483 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'restart_timer',
initial: 'normal',
states: {
normal: {
on: {
tick: {
actions: ['check_edith']
},
app_down: 'critical'
}
},
critical: {
entry: ['start_timeout'],
on: {
tick: {
actions: ['check_edith']
},
stop_timeout: 'deferred',
app_up: 'normal',
timeout: {
target: 'normal',
actions: ['run_stop']
},
}
},
deferred: {
on: {
tick: {
actions: ['check_edith']
},
app_up: 'normal'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment