Skip to content

Instantly share code, notes, and snippets.

@ekafyi
Created July 21, 2020 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekafyi/f2a882ace48349be8cf8076e09082668 to your computer and use it in GitHub Desktop.
Save ekafyi/f2a882ace48349be8cf8076e09082668 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const tapStates = {
initial: 'tapOff',
states: {
tapOff: {
on: {
TURN_ON: 'tapOn'
}
},
tapOn: {
on: {
TURN_OFF: 'tapOff'
}
}
}
};
const handWashMachine3 = Machine({
id: 'handwash',
initial: 'unwashed',
states: {
unwashed: {
on: {
START_WASH: 'washing'
}
},
washing: {
on: {
STOP_WASH: 'unwashed'
},
after: {
20000: 'washed'
},
...tapStates
},
washed: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment