Created
July 31, 2021 12:09
-
-
Save deniaz/8dfa2e170aa75f31a61f71f44bc17c77 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 pos = Machine({ | |
initial: "scanning", | |
states: { | |
scanning: { | |
on: { | |
CANCEL: "scanning", | |
CONTINUE: "payment-method", | |
}, | |
}, | |
"payment-method": { | |
on: { | |
CASH: "payment", | |
CARD: "payment", | |
}, | |
}, | |
payment: { | |
on: { | |
SUCCESS: "ka-ching!💰", | |
ERROR: "payment-method", | |
}, | |
}, | |
"ka-ching!💰": { | |
type: "final", | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment