Skip to content

Instantly share code, notes, and snippets.

@elsangedy
Last active February 26, 2021 04:40
Show Gist options
  • Save elsangedy/1afe62aff4e8b58848381ada8d06983b to your computer and use it in GitHub Desktop.
Save elsangedy/1afe62aff4e8b58848381ada8d06983b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// TAP FRONTEND
const appMachine = Machine(
{
id: 'tap',
initial: 'init',
context: {},
on: {
RESTART: {
target: 'init',
actions: ['update'],
},
FINISH_SETUP: {
target: 'operation',
actions: ['update'],
},
START_MAINTENANCE: {
target: 'maintenance',
actions: ['update'],
},
FINISH_MAINTENANCE: {
target: 'operation',
actions: ['update'],
},
START_OPERATION: {
target: 'operation',
actions: ['update'],
},
START_CONSUMPTION: {
target: 'consumption',
actions: ['update'],
},
FINISH_CONSUMPTION: {
target: 'operation',
actions: ['update'],
},
FLOW: {
target: 'consumption',
actions: ['update'],
},
},
states: {
init: {},
unavailable: {},
setup: {},
maintenance: {},
operation: {},
consumption: {},
feedback: {
after: {
5000: 'operation',
},
},
},
},
{
actions: {
update: assign((_, event) => {
return event.data;
}),
},
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment