Skip to content

Instantly share code, notes, and snippets.

@tivac
Created March 11, 2020 16:37
Show Gist options
  • Save tivac/003e752a80eb0e5aa40db4f30c8c315a to your computer and use it in GitHub Desktop.
Save tivac/003e752a80eb0e5aa40db4f30c8c315a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: "delay + state",
type: "parallel",
context : {
fetched : false,
},
on : {
FETCHED : {
actons : assign({ fetched : true }),
},
},
states: {
status: {
initial: "intros",
states: {
intros: {
after: {
2000: "show",
},
},
show: {
on : {
"" : {
cond : ({ fetched }) => fetched,
target : "done",
},
FETCHED : "done",
},
},
done: {},
},
},
fetching: {
initial: "running",
states: {
running: {
after: {
1500: "done",
},
},
done: {
entry : raise("FETCHED")
},
}
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment