Skip to content

Instantly share code, notes, and snippets.

@zzzzBov

zzzzBov/machine.js

Last active Jan 24, 2021
Embed
What would you like to do?
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: "opener",
initial: "closed",
context: {},
states: {
closed: {
id: "closed",
on: {
OPEN: "opened",
TOGGLE: "opened",
},
},
opened: {
initial: "idle",
states: {
idle: {
on: {
AUTOCLOSE: "closing",
},
},
closing: {
on: {
CANCEL: "idle",
},
after: {
0: "close",
},
},
close: {
type: "final",
},
},
on: {
CLOSE: "closed",
TOGGLE: "closed",
},
onDone: "closed",
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment