Skip to content

Instantly share code, notes, and snippets.

@aethant
Created February 27, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aethant/0dbcde1bdd7c612a351a38d365bd7b5d to your computer and use it in GitHub Desktop.
Save aethant/0dbcde1bdd7c612a351a38d365bd7b5d to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// 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