Created
September 2, 2020 13:53
-
-
Save areai51/59288f9d0850a5499ea6237049c9858e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
| const pedestrianStates = { | |
| initial: 'walk', | |
| states: { | |
| walk: { | |
| on: { | |
| PED_COUNTDOWN: 'wait' | |
| } | |
| }, | |
| wait: { | |
| on: { | |
| PED_COUNTDOWN: 'stop' | |
| } | |
| }, | |
| stop: {}, | |
| blinking: {} | |
| } | |
| }; | |
| const lightMachine = Machine({ | |
| key: 'light', | |
| initial: 'green', | |
| states: { | |
| green: { | |
| on: { | |
| TIMER: 'yellow' | |
| } | |
| }, | |
| yellow: { | |
| on: { | |
| TIMER: 'red' | |
| } | |
| }, | |
| red: { | |
| on: { | |
| TIMER: 'green' | |
| }, | |
| ...pedestrianStates | |
| } | |
| }, | |
| on: { | |
| POWER_OUTAGE: '.red.blinking', | |
| POWER_RESTORED: '.red' | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment