Created
May 8, 2020 18:05
-
-
Save svagi/8aef8cebba32f00b9e0e9e7ca28a21d2 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 fetchStates = { | |
initial: 'loading', | |
states: { | |
loading: { | |
on: { | |
RESOLVE: 'resolved', | |
REJECT: 'rejected' | |
} | |
}, | |
resolved: { | |
type: 'final' | |
}, | |
rejected: { | |
type: 'final' | |
} | |
} | |
}; | |
const appMachine = Machine({ | |
id: 'app', | |
initial: 'idle', | |
states: { | |
"idle": { | |
on: { | |
"": "app-loading" | |
} | |
}, | |
"app-loading":{ | |
type: "parallel", | |
states: { | |
"toggle-loading": fetchStates, | |
"db-def-loading": fetchStates | |
}, | |
onDone: "app-render", | |
}, | |
"app-render": { | |
type: "parallel", | |
states: { | |
"ds-loading": fetchStates, | |
"fields-loading": fetchStates | |
} | |
} | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment