Skip to content

Instantly share code, notes, and snippets.

@dburrows
Last active December 19, 2019 14:06
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 dburrows/d58048fd9af6e18fcb53caa38f1876be to your computer and use it in GitHub Desktop.
Save dburrows/d58048fd9af6e18fcb53caa38f1876be 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: 'delete',
initial: 'idle',
states: {
idle: {
on: {
DELETE: 'requesting'
}
},
requesting: {
on: {
REQUEST: 'loading'
}
},
loading: {
on: {
LOADED: 'loaded'
}
},
loaded: {
on: {
RESOLVE: 'notify',
REJECT: 'failure'
}
},
notify: {
on: {
NOTIFIED: 'finished'
}
},
finished: {
type: 'final'
},
failure: {
on: {
DELETE: 'requesting'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment