Skip to content

Instantly share code, notes, and snippets.

@yy-dev7
Last active January 27, 2021 02:39
Show Gist options
  • Save yy-dev7/19a5dbe60dac21a6b739200b22c2d3ab to your computer and use it in GitHub Desktop.
Save yy-dev7/19a5dbe60dac21a6b739200b22c2d3ab to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const surveyMachine = Machine({
id: 'survey',
initial: 'index',
states: {
index: {
on: {
VERIFICATION_ACTIVE: 'verification',
VERIFICATION_INACTIVE: 'start',
}
},
verification: {
type: 'compound',
initial: 'page1',
states: {
page1: {
on: {
NEXT: 'page2',
}
},
page2: {
on: {
AGREE: 'page3',
DISAGREE: '#abnormalEnd',
}
},
page3: {
on: {
AGREE: '#start',
DISAGREE: '#abnormalEnd',
}
},
}
},
start: {
id: 'start',
on: {
SKIP_WELCOME: 'answer',
WELCOME: 'welcome',
}
},
welcome: {
id: 'welcome',
on: {
NEXT: 'answer'
}
},
answer: {
on: {
NON_RECOVERABLE: 'abnormalEnd',
RECOVERABLE: 'end'
}
},
end: {
type: 'final'
},
abnormalEnd: {
id: 'abnormalEnd',
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment