Skip to content

Instantly share code, notes, and snippets.

@ColadaFF
Last active November 4, 2020 15:59
Show Gist options
  • Save ColadaFF/ac31713951334372ed68be68634a27d1 to your computer and use it in GitHub Desktop.
Save ColadaFF/ac31713951334372ed68be68634a27d1 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 recordMachine = Machine({
id: "record",
initial: "start",
context: {
cameraIp: "",
},
states: {
start: {
on: {
STOP: "stop"
}
},
stop: {
type: 'final'
}
}
})
const localMachine = Machine({
id: "local",
initial: "idle",
context: {
leftRecording: null,
rightRecording: null,
topRecording: null
},
states: {
idle: {
on: {
START: "start"
}
},
start: {
entry: assign({
leftRecording: () => spawn(recordMachine),
rightRecording: () => spawn(recordMachine),
topRecording: () => spawn(recordMachine)
}),
on: {
STOP: {
actions: send("STOP", {
to: context => context.leftRecording
})
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment