Last active
March 29, 2021 12:10
-
-
Save taktran/6cffa9e950ab85ae3686dee906a26bd7 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
// 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