Skip to content

Instantly share code, notes, and snippets.

@diestrin
Created February 5, 2021 19:26
Show Gist options
  • Save diestrin/74d90996823dd112ec6bb3323ac46429 to your computer and use it in GitHub Desktop.
Save diestrin/74d90996823dd112ec6bb3323ac46429 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({
context: {},
type: 'parallel',
states: {
setup: {
on: {
SETUP: {
actions: ['setupSpace', 'reply']
}
}
},
selectable: {
initial: 'available',
states: {
available: {
on: {
RESERVE: {
target: 'reserved',
actions: ['reserveSpace','reply']
}
}
},
reserved: {
on: {
RELEASE: {
target: 'available',
actions: ['releaseSpace','reply']
}
}
}
}
},
presence: {
initial: 'unfilled',
states: {
unfilled: {
on: {
FILL: {
target: 'filled',
actions: ['reply']
},
}
},
filled: {
on: {
UNFILL: {
target: 'unfilled',
actions: ['reply']
}
}
}
}
},
secure: {
initial: 'close',
states: {
close: {
on: {
OPEN: {
target: 'open',
actions: ['openDoor', 'reply']
}
}
},
open: {
on: {
CLOSE: {
target: 'close',
actions: ['closeDoor','reply']
}
}
}
}
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment