Skip to content

Instantly share code, notes, and snippets.

@emptymalei
Last active March 4, 2020 12:53
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 emptymalei/ed81391d2675b3740b5a7fd6ea9f86b3 to your computer and use it in GitHub Desktop.
Save emptymalei/ed81391d2675b3740b5a7fd6ea9f86b3 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: 'kitchen',
initial: 'notAssignedForToday',
context: {
retries: 1
},
states: {
notAssignedForToday: {
onEntry: 'findNextPerson()',
on: {
ASSIGN_PERSON: 'awaitingAcceptance'
}
},
awaitingAcceptance: {
on: {
ACCEPTED: 'assignedForToday',
REJECTED: 'notAssignedForToday',
TIMEOUT: 'notAssignedForToday'
}
},
assignedForToday: {
onEntry: 'sayThanks()',
on: {
DAYCHANGED: 'notAssignedForToday',
WANT_TO_BAIL_OUT: 'notAssignedForToday',
FINISHED: 'waitForDayChange'
}
},
waitForDayChange: {
on: {
DAYCHANGED: 'notAssignedForToday',
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment