Created
November 13, 2020 16:20
-
-
Save jbeast/c604754c94339b44abec3547346f3255 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
const validateBarcode = () => {}; | |
const findLabware = () => {}; | |
const labwareScannerMachine = Machine({ | |
key: 'labwareScanner', | |
initial: 'idle', | |
states: { | |
idle: { | |
id: "idle", | |
initial: "normal", | |
states: { | |
normal: {}, | |
error: {}, | |
success: {} | |
}, | |
on: { | |
SCAN_BARCODE: "validating" | |
} | |
}, | |
validating: { | |
invoke: { | |
id: "validateBarcode", | |
src: validateBarcode, | |
onDone: { | |
target: "finding" | |
}, | |
onError: { | |
target: "idle.error" | |
} | |
} | |
}, | |
finding: { | |
invoke: { | |
id: "findLabware", | |
src: findLabware, | |
onDone: { | |
target: "idle.success" | |
}, | |
onError: { | |
target: "idle.error" | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment