Skip to content

Instantly share code, notes, and snippets.

@BobToninho
Last active October 6, 2021 12:34
Show Gist options
  • Save BobToninho/eb56a449242f3c49988872cfefbe5b28 to your computer and use it in GitHub Desktop.
Save BobToninho/eb56a449242f3c49988872cfefbe5b28 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: 'fetch',
initial: 'idle',
context: {
loadingsPerformed: 0
},
states: {
idle: {
on: {
FIRST_FETCH: 'first-loading',
FETCH: 'loading',
FINISHED: 'loaded'
}
},
'first-loading': {
on: {
LOAD_COMPLETE: 'idle'
}
},
loading: {
on: {
LOAD_COMPLETE: 'idle'
}
},
loaded: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment