Skip to content

Instantly share code, notes, and snippets.

@Fxlr8
Last active April 8, 2020 18:51
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 Fxlr8/2b79b131e4c5d3d8eaaef6f63afb1c1d to your computer and use it in GitHub Desktop.
Save Fxlr8/2b79b131e4c5d3d8eaaef6f63afb1c1d 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 botMachine = Machine({
id: 'bot',
initial: 'offline',
states: {
offline: {
on: {
LOGIN: 'authenticating'
}
},
authenticating: {
on: {
RESOLVE: 'idle',
REJECT: 'failure'
}
},
idle: {
on: {
TIMER: 'matchSelect'
}
},
matchSelect: {
on: {
RESOLVE: 'joining',
REJECT: 'idle'
}
},
joining: {
on: {
RESOLVE: 'inMatch',
REJECT: 'idle'
}
},
inMatch: {
on: {
DONE: 'idle'
}
},
failure: {
on: {
RETRY: {
target: 'authenticating',
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