Skip to content

Instantly share code, notes, and snippets.

@amypellegrini
Created January 23, 2020 21:02
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 amypellegrini/cb8f4f239d4c23ef1c9c5d41cd2e8e84 to your computer and use it in GitHub Desktop.
Save amypellegrini/cb8f4f239d4c23ef1c9c5d41cd2e8e84 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const scaleChartGeneratorMachine = Machine({
id: 'scale-chart-generator',
initial: 'default',
context: {
musicKey: undefined,
scaleName: undefined,
withKeySignature: false,
},
states: {
default: {
on: {
SELECT_SCALE: {
target: 'selectedScale',
},
TOGGLE_KEY_SIGNATURE: {
target: 'default',
},
},
},
selectedScale: {
on: {
SELECT_SCALE: {
target: 'selectedScale',
},
RESET: {
target: 'default',
},
SELECT_MUSIC_KEY: {
target: 'showScaleChart',
},
TOGGLE_KEY_SIGNATURE: {
target: 'selectedScale',
},
},
},
showScaleChart: {
on: {
SELECT_SCALE: {
target: 'selectedScale',
},
RESET: {
target: 'default',
},
RESET_MUSIC_KEY: {
target: 'selectedScale',
},
SELECT_MUSIC_KEY: {
target: 'showScaleChart',
},
TOGGLE_KEY_SIGNATURE: {
target: 'showScaleChart',
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment