Skip to content

Instantly share code, notes, and snippets.

@mmontone
Created September 27, 2019 21:07
Show Gist options
  • Save mmontone/f418585b3494328f5aed8b4224ae0390 to your computer and use it in GitHub Desktop.
Save mmontone/f418585b3494328f5aed8b4224ae0390 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const UINavigator = Machine({
id: 'UI',
initial: 'running',
states: {
running: {
initial: 'home',
states: {
home: {
entry: ['home'],
on: {
bed: 'bedcontrols',
cpr: 'cpr',
presets: 'presets',
settings: 'settings'
}
},
bedcontrols: {
initial: 'sideview',
states: {
sideview: {
entry: ['sideview'],
on: {
front: 'frontview',
perspective: 'perspectiveview'
}
},
frontview: {
entry: ['frontview'],
on: {
side : 'sideview',
perspective:'perspectiveview'
}
},
perspectiveview: {
entry: ['perspectiveview'],
on: {
side: 'sideview',
front: 'frontview'
}
},
hist: {
type: 'history'
}
},
on: {
home: 'home',
cpr: 'cpr',
presets: 'presets',
play: 'play'
}
},
cpr: {
entry: ['cpr'],
on: {
home: 'home'
}
},
presets: {
entry: ['presets'],
on: {
home: 'home',
bed: 'bedcontrols'
}
},
play: {
entry: ['play'],
initial: 'playing',
states: {
playing: {
entry: ['play'],
on: {
'pause': 'paused'
}
},
paused: {
entry: ['pause'],
on: {
'play': 'playing'
}
}
},
on: {
'cancel': 'bedcontrols.hist',
}
},
settings: {
entry: ['settings'],
on: {
home: 'home'
},
},
hist: {
type: 'history',
history: 'deep'
}
},
on: {
stop: 'stopped',
block: 'blocked'
}
},
stopped: {
entry: ['stop'],
on: {
resume: 'running.hist',
cpr: 'running.cpr'
}
},
blocked: {
entry: ['lockscreen'],
on: {
stop: 'stopped',
unblock: 'running.hist'
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment