Skip to content

Instantly share code, notes, and snippets.

@taktran
Last active March 29, 2021 12:10
Show Gist options
  • Save taktran/6cffa9e950ab85ae3686dee906a26bd7 to your computer and use it in GitHub Desktop.
Save taktran/6cffa9e950ab85ae3686dee906a26bd7 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 pollingMachine = Machine({
id: 'polling',
initial: 'INIT',
states: {
INIT: {
on: {
START: 'STARTED'
}
},
STARTED: {
on: {
START_POLLING: 'PENDING',
TRIGGER_ERROR: 'FAILURE'
}
},
PENDING: {
on: {
STATUS_PENDING: 'PENDING',
STATUS_SUCCESS: 'SUCCESS',
STATUS_FAILURE: 'FAILURE',
TIMEOUT: 'FAILURE'
}
},
SUCCESS: {
type: 'final'
},
FAILURE: {
on: {
RESET: 'INIT'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment