Skip to content

Instantly share code, notes, and snippets.

@hlkn
Created July 12, 2023 05:19
Show Gist options
  • Save hlkn/2238a6daf4ec509afc3f64050cb5aae2 to your computer and use it in GitHub Desktop.
Save hlkn/2238a6daf4ec509afc3f64050cb5aae2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const waterMachine = Machine({
id: 'water',
initial: 'liquid',
states: {
ice: {
on : {
HEAT: {
target: "liquid"
}
}
},
liquid: {
on: {
HEAT: {
target: "gas"
},
FREEZE: {
target: "ice"
}
}
},
gas: {
on: {
HEAT: {
target: "plasma"
},
FREEZE: {
target: "liquid"
}
}
},
plasma: {
on: {
FREEZE: {
target: "gas"
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment