Skip to content

Instantly share code, notes, and snippets.

@zetavg
Created December 25, 2019 09:55
Show Gist options
  • Save zetavg/6d143661b983445a7fa4a74c004c49d3 to your computer and use it in GitHub Desktop.
Save zetavg/6d143661b983445a7fa4a74c004c49d3 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const appMachine = Machine({
id: 'app',
initial: 'unauthenticated',
states: {
unauthenticated: {
on: {
LOGIN: 'authenticated',
},
},
authenticated: {
on: {
LOGOUT: {
target: 'unauthenticated',
},
},
type: 'parallel',
states: {
playback: {
initial: 'stopped',
states: {
playing: {
on: {
PAUSE: 'paused',
STOP: 'stopped',
},
},
paused: {
on: {
PLAY: 'playing',
STOP: 'stopped',
},
},
stopped: {
on: {
PLAY: 'playing',
},
},
},
},
repeat: {
initial: 'off',
states: {
off: {
on: {
TOGGLE_REPEAT_MODE: 'all',
},
},
all: {
on: {
TOGGLE_REPEAT_MODE: 'one',
},
},
one: {
on: {
TOGGLE_REPEAT_MODE: 'off',
},
},
}
}
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment