Skip to content

Instantly share code, notes, and snippets.

@theghostyced
Last active July 10, 2020 20:25
Show Gist options
  • Save theghostyced/19c02982ed9b846ee9ee74595d6d2570 to your computer and use it in GitHub Desktop.
Save theghostyced/19c02982ed9b846ee9ee74595d6d2570 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: 'playerselect',
initial: 'player_select',
context: {
player: null
},
states: {
player_select: {
on: {
PLAYER_SELECTED: {
target: 'player_selected',
actions: assign({
player: (_, event) => event.player_type
})
}
}
},
player_selected: {},
cancel: {
on: {
CANCELLED: 'player_select'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment