Skip to content

Instantly share code, notes, and snippets.

@sebabouche
Last active April 7, 2021 06:53
Show Gist options
  • Save sebabouche/6377c08563c645ac237bc0938f8caf80 to your computer and use it in GitHub Desktop.
Save sebabouche/6377c08563c645ac237bc0938f8caf80 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 envMachine = Machine(
{
id: "env",
initial: "inactive",
context: {
level: 0,
},
states: {
inactive: {
id: "inactive",
on: {
START: "inSession",
},
},
inSession: {
initial: "idle",
states: {
idle: {
on: {
STOP: "#inactive",
HARDWARE: "hardware",
HUMAN: "human",
ENVIRONMENT: "environment",
SOS: "unkownSOS",
},
},
hardware: {
initial: "unkown",
states: {
unkown: {
on: {
ME: "me",
TRAINEE: "trainee",
THIRD_PARTY: "thirdParty",
},
},
me: {},
trainee: {},
thirdParty: {},
},
},
human: {
},
environment: {
},
unkownSOS: {
entry: "setLevel3",
},
},
},
},
},
{
actions: {
setLevel3: ctx => (ctx.level = 3),
},
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment