Skip to content

Instantly share code, notes, and snippets.

@jbeast
Created November 13, 2020 16:20
Show Gist options
  • Save jbeast/c604754c94339b44abec3547346f3255 to your computer and use it in GitHub Desktop.
Save jbeast/c604754c94339b44abec3547346f3255 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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