Created
March 11, 2020 16:37
-
-
Save tivac/003e752a80eb0e5aa40db4f30c8c315a 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
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