Last active
January 3, 2020 22:20
-
-
Save jdpigeon/022b8bb15ea5aebb834b436c604a2138 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 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