Skip to content

Instantly share code, notes, and snippets.

@randallagordon
Created April 14, 2020 18:20
Show Gist options
  • Save randallagordon/ac474791aa5ed5003b9d02f233982801 to your computer and use it in GitHub Desktop.
Save randallagordon/ac474791aa5ed5003b9d02f233982801 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({
initial: "closed",
states: {
closed: {
on: {
OPEN: "opening"
}
},
opening: {
invoke: {
src: "openMenu",
onDone: { target: "open" }
},
on: {
CLOSE: "closing"
}
},
open: {
on: {
CLOSE: "closing"
}
},
closing: {
invoke: {
src: "closeMenu",
onDone: { target: "closed" }
},
on: {
OPEN: "opening"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment