Skip to content

Instantly share code, notes, and snippets.

@cp
Last active June 29, 2022 18:19
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 cp/e04cb683f315d12b122c38e46ad9cb25 to your computer and use it in GitHub Desktop.
Save cp/e04cb683f315d12b122c38e46ad9cb25 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)
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const TEST_VIEWS = {
hubConnection: "hubConnection",
hubConnectionError: "hubConnectionError",
audioExplainer: "audioExplainer",
questionnaire: "questionnaire",
video: "video",
multistepAnimation: "multistepAnimation",
resultCollection: "resultCollection",
};
const fetchMachine = Machine({
initial: "idle",
states: {
idle: {
on: {
start: "checkingHubConnection",
},
},
checkingHubConnection: {
meta: {
view: TEST_VIEWS.hubConnection,
},
on: {
success: "fastingIntro",
error: "hubConnectionError",
},
},
hubConnectionError: {
meta: {
view: TEST_VIEWS.hubConnectionError,
},
on: {
retry: "checkingHubConnection",
},
},
fastingIntro: {
meta: {
view: TEST_VIEWS.audioExplainer,
},
on: {
success: "fastingQuestionnaire",
exit: "idle",
},
},
fastingQuestionnaire: {
meta: {
view: TEST_VIEWS.questionnaire,
},
on: {
success: "lgOnboarding",
exit: "idle",
},
},
lgOnboarding: {
meta: {
view: TEST_VIEWS.video,
},
on: {
success: "lgPrepare",
exit: "idle",
},
},
lgPrepare: {
meta: { view: TEST_VIEWS.multistepAnimation },
on: {
exit: "idle",
success: "lgSetup",
},
},
lgSetup: {
meta: { view: TEST_VIEWS.multistepAnimation },
on: {
exit: "idle",
success: "lgPipetteInstructions",
},
},
lgPipetteInstructions: {
meta: { view: TEST_VIEWS.video },
on: {
exit: "idle",
success: "lgTest",
},
},
lgTest: {
meta: { view: TEST_VIEWS.multistepAnimation },
on: {
exit: "idle",
success: "lgResultCollection",
},
},
lgResultCollection: {
meta: { view: TEST_VIEWS.resultCollection },
on: {
exit: "idle",
retry: "lgTest",
success: "idle",
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment