Skip to content

Instantly share code, notes, and snippets.

@gilesbutler
Last active Apr 13, 2020
Embed
What would you like to do?
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const appMachine = Machine({
id: 'app',
initial: 'idle',
context: {
//
},
states: {
idle: {
on: {
SYNC: 'syncing'
}
},
syncing: {
on: {
SUCCESS: 'idle',
FAILURE: 'failure'
}
},
failure: {
on: {
RETRY: {
target: 'syncing',
// actions: assign({
// retries: (context, event) => context.retries + 1
// })
}
}
}
}
});
const gameMachine = Machine({
id: 'game',
initial: 'idle',
context: {
//
},
states: {
idle: {
on: {
WAITING: 'waiting'
}
},
waiting: {
on: {
START_GAME: 'overview'
}
},
overview: {
on: {
START_ROUND: 'playing'
}
},
playing: {
on: {
FINISH_ROUND: 'overview'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment