Skip to content

Instantly share code, notes, and snippets.

@reedspool
Last active April 12, 2021 06:06
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 reedspool/db9e05eba8606ed807b785707e5d75f3 to your computer and use it in GitHub Desktop.
Save reedspool/db9e05eba8606ed807b785707e5d75f3 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 fetchMachine =Machine({
id: "cat",
initial: "kitten",
strict: true,
on : {
talk: { actions: [ () => console.log("meeeoooowww") ] }
},
states: {
kitten: {
on: {
talk: {
target: "kittenforever",
actions: [ () => console.log("mew mew mew") ]
}
}
},
kittenforever : {
on: {
talk: {
actions: [ function () { throw new Error("I don't want to talk") }]
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment