Created
March 8, 2021 14:24
-
-
Save elsangedy/77a8595c6ef29fbc79fbb91132fb8444 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
// INSTRUMENT | |
const fetchMachine = Machine( | |
{ | |
id: 'device', | |
initial: 'connection', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
connection: { | |
on: { | |
SELECT_DEVICE: 'extraction', | |
}, | |
}, | |
extraction: { | |
initial: 'semiAuto', | |
on: { | |
INCISION: 'incision', | |
CHANGE_CONNECTION: 'connection', | |
}, | |
states: { | |
semiAuto: { | |
initial: 'idle', | |
on: { | |
CHANGE_MODE: 'manual', | |
}, | |
states: { | |
idle: { | |
on: { | |
START: 'operation', | |
}, | |
}, | |
operation: { | |
on: { | |
FINISH: 'finished', | |
}, | |
}, | |
finished: { | |
type: 'final', | |
} | |
} | |
}, | |
manual: { | |
initial: 'operation', | |
on: { | |
CHANGE_MODE: 'semiAuto', | |
}, | |
states: { | |
operation: { | |
on: { | |
FINISH: 'finished', | |
}, | |
}, | |
finished: { | |
type: 'final', | |
}, | |
}, | |
}, | |
} | |
}, | |
incision: { | |
initial: 'operation', | |
on: { | |
EXTRACTION: 'extraction', | |
CHANGE_CONNECTION: 'connection', | |
}, | |
states: { | |
operation: { | |
on: { | |
FINISH: 'finished', | |
}, | |
}, | |
finished: { | |
type: 'final', | |
}, | |
} | |
}, | |
}, | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment