Last active
November 4, 2020 15:59
-
-
Save ColadaFF/ac31713951334372ed68be68634a27d1 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 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