Created
February 27, 2020 20:23
-
-
Save aethant/0dbcde1bdd7c612a351a38d365bd7b5d 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 sm = Machine({ | |
id: "stepper", | |
initial: "idle", | |
context: { | |
year: "", | |
make: false, | |
model: false, | |
bodystyles: false | |
}, | |
reset: "#stepper.idle", | |
states: { | |
idle: { | |
on: { | |
year: [ | |
{ | |
target: "make", | |
cond: "yearsStep" | |
}, | |
{ | |
target: "idle" | |
} | |
] | |
} | |
}, | |
year: { | |
on: { | |
year: [ | |
{ | |
target: "make", | |
cond: "yearsStep" | |
}, | |
{ | |
target: "idle" | |
} | |
], | |
make: "make" | |
} | |
}, | |
make: { | |
on: { | |
make: [ | |
{ | |
target: "make", | |
cond: "makesStep" | |
}, | |
{ | |
target: "year" | |
} | |
], | |
year: [ | |
{ | |
target: "make", | |
cond: "yearsStep" | |
}, | |
{ | |
target: "idle" | |
} | |
] | |
} | |
}, | |
model: { | |
on: { | |
year: [ | |
{ | |
target: "make", | |
cond: "yearsStep" | |
}, | |
{ | |
target: "idle" | |
} | |
] | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment