Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Last active January 3, 2021 20:07
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 jlengstorf/07c5f8934cc27d1aee816453e3eae0af to your computer and use it in GitHub Desktop.
Save jlengstorf/07c5f8934cc27d1aee816453e3eae0af 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: 'effects',
initial: 'idle',
context: {
transitionSpeed: 600,
duration: 4000,
},
states: {
idle: {
on: {
COMMAND: {
actions: 'setCommandDetails',
target: 'loading',
}
}
},
loading: {
invoke: {
src: 'loadEffectResources',
onDone: 'transitioningIn',
onError: 'error',
}
},
transitioningIn: {
invoke: {
src: 'startEffectAnimation',
onDone: 'active',
onError: 'error',
}
},
active: {
entry: 'playSoundEffect',
invoke: 'waitForEffectDuration',
onDone: 'transitioningOut',
},
transitioningOut: {
invoke: 'endEffectAnimation',
onDone: 'idle',
onError: 'error',
},
error: {
on: {
'': 'idle',
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment