Last active
April 13, 2020 02:21
-
-
Save gilesbutler/6649cbbf4ee6409591f4edfaa2e7976f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 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