Last active
January 3, 2021 20:07
-
-
Save jlengstorf/07c5f8934cc27d1aee816453e3eae0af 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 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