Skip to content

Instantly share code, notes, and snippets.

@jesperp
Last active February 19, 2020 17:48
Show Gist options
  • Save jesperp/fc9b525eec7e409b6264ea49fcc02349 to your computer and use it in GitHub Desktop.
Save jesperp/fc9b525eec7e409b6264ea49fcc02349 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 fetchMachine = Machine({
id: 'operator',
type: 'parallel',
context: {
currentSound: 234,
},
states: {
numpad: {
initial: 'idle',
states: {
idle: {
on: {
BTN_NUMBER_PRESS: 'idle',
BTN_NUMBER_HOLD: 'hold',
},
},
hold: {
BTN_NUMBER_RELEASE: 'idle'
},
},
},
sound: {
initial: 'idle',
states: {
idle: {
on: {
BTN_SOUND_HOLD: 'selecting'
}
},
selecting: {
on: {
BTN_SOUND_RELEASE: 'idle',
},
},
},
},
playMode: {
initial: 'stopped',
states: {
stopped: {
on: { BTN_PLAY_PRESS: 'playing' }
},
playing: {
on: { BTN_PLAY_PRESS: 'stopped' }
}
}
},
writeMode: {
initial: 'inactive',
states: {
inactive: {
on: {
BTN_WRITE_PRESS: 'step',
BTN_WRITE_HOLD: 'live',
},
},
step: {
on: { BTN_WRITE: 'inactive' },
},
live: {
on: { BTN_WRITE_RELEASE: 'inactive' },
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment