Created
July 14, 2020 22:05
-
-
Save simmo/7a0312c690f898a7023d4712c8ee26ce to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'e-comm', | |
initial: 'landing', | |
states: { | |
landing: { | |
on: { | |
NEXT: 'hasMotorSkills' | |
} | |
}, | |
hasMotorSkills: { | |
on: { | |
RESET: 'landing', | |
PREV: 'landing', | |
NEXT: 'canSitWithoutAssistance' | |
} | |
}, | |
canSitWithoutAssistance: { | |
on: { | |
RESET: 'landing', | |
PREV: 'hasMotorSkills', | |
NEXT: 'pickType', | |
} | |
}, | |
pickType: { | |
on: { | |
RESET: 'landing', | |
PREV: 'canSitWithoutAssistance', | |
NEXT: 'pickChair', | |
} | |
}, | |
pickChair: { | |
on: { | |
RESET: 'landing', | |
PREV: 'pickType', | |
NEXT: 'payment', | |
} | |
}, | |
payment: { | |
on: { | |
CANCEL: 'landing', | |
FAIL: 'paymentFailed', | |
SUCCESS: 'complete', | |
} | |
}, | |
paymentFailed: { | |
on: { | |
CANCEL: 'landing', | |
RETRY: 'payment', | |
} | |
}, | |
complete: {}, | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment