Skip to content

Instantly share code, notes, and snippets.

@gilesbutler
Last active April 13, 2020 02:21
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 gilesbutler/6649cbbf4ee6409591f4edfaa2e7976f to your computer and use it in GitHub Desktop.
Save gilesbutler/6649cbbf4ee6409591f4edfaa2e7976f 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 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