Skip to content

Instantly share code, notes, and snippets.

@j0hnm4r5
Last active June 8, 2021 21:16
Show Gist options
  • Save j0hnm4r5/158725702c0fd537f16ea91bbf217c58 to your computer and use it in GitHub Desktop.
Save j0hnm4r5/158725702c0fd537f16ea91bbf217c58 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'a101',
initial: 'm_1',
states: {
m_1: {
on: {
OKAY: 'm_2',
}
},
m_2: {
on: {
SAY_YES: 'm_3',
SAY_NO: 'm_4',
DO_NOT_RESPOND: 'm_2',
}
},
m_3: {
after: {
// after 2 seconds, transition
2000: { target: 'm_4' }
}
},
m_4: {
on: {
QUESTION_WHY: 'm_5',
YELL_AT_THEM: 'm_6',
}
},
m_5: {
type: 'final',
},
m_6: {
type: 'final',
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment