Skip to content

Instantly share code, notes, and snippets.

@jbeast
Created March 2, 2021 12:07
Show Gist options
  • Save jbeast/3b5454aaf14c78258050013de528d57c to your computer and use it in GitHub Desktop.
Save jbeast/3b5454aaf14c78258050013de528d57c 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 workshopMachine = Machine({
id: 'workshop',
initial: 'idle',
context: {
capacity: 5
},
states: {
open: {
on: {
FETCH: 'loading'
}
},
closed: {
on: {
RESOLVE: 'success',
REJECT: 'failure'
}
},
full: {
type: 'final'
},
cancelled: {
on: {
RETRY: {
target: 'loading',
actions: assign({
retries: (context, event) => context.retries + 1
})
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment