Last active
July 10, 2020 20:25
-
-
Save theghostyced/19c02982ed9b846ee9ee74595d6d2570 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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