Skip to content

Instantly share code, notes, and snippets.

@zaydek
Created September 19, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaydek/ead1677f8abc49569aada489c6d24f6a to your computer and use it in GitHub Desktop.
Save zaydek/ead1677f8abc49569aada489c6d24f6a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const userMachine = Machine({
id: "user",
initial: "loading",
states: {
loading: {
invoke: {
id: "loadingHandler",
src: (ctx, _) => (callback, _) => {
setTimeout(() => {
callback("success")
}, 1e3)
},
},
},
success: {
type: "final",
},
failure: {
on: {
RETRY: "loading"
},
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment