Skip to content

Instantly share code, notes, and snippets.

@jdpigeon
Last active January 3, 2020 22:20
Show Gist options
  • Save jdpigeon/022b8bb15ea5aebb834b436c604a2138 to your computer and use it in GitHub Desktop.
Save jdpigeon/022b8bb15ea5aebb834b436c604a2138 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 spikeTrainingMachine = Machine({
id: 'spikeTraining',
initial: 'idle',
context: {
contextVar: 0
},
states: {
idle: {
on: {
CHANNEL_SELECTED: 'viewSelected',
CHANNEL_UNSELECTED: 'viewAll'
}
},
viewAll: {
on: {
CHANNEL_SELECTED: 'viewSelected'
}
},
viewSelected: {
on: {
CHANNEL_UNSELECTED: 'viewAll',
RECORD: 'record',
TRAIN: 'train'
}
},
record: {
on: {
STOP: 'wait',
ABORT: 'viewSelected'
}
},
wait: {
on: {
RECEIVE_DISCOVERY: 'viewDiscovery',
RECEIVE_CALIBRATION: 'viewCalibration'
}
},
viewDiscovery: {
on: {
REJECT_DISCOVERY: 'viewSelected',
ACCEPT_DISCOVERY: 'testSpikes'
}
},
testSpikes: {
on: {
SAVE: 'train',
RESELECT: 'viewDiscovery'
}
},
viewCalibration: {
on: {
REJECT_CALIBRATION: 'train',
ACCEPT_CALIBRATION: 'train'
}
},
train: {
on: {
VIEW: 'viewSelected',
CALIBRATE: 'wait',
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment