Last active
May 3, 2020 21:56
-
-
Save rootart/d1ecbba7c2d4b5c6cfc76d82a2773e24 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 triathlonMachine = Machine( | |
| { | |
| id: 'triathlonMachine', | |
| initial: 'idle', | |
| context: { | |
| startTime: null, | |
| transitionOneStart: null, | |
| cyclingLegStart: null, | |
| transitionTwoStart: null, | |
| runningLegStart: null, | |
| finishEnd: null, | |
| dnfTime: null, | |
| }, | |
| on: { | |
| PULL_OUT: 'dnf', | |
| cond: () => {} | |
| }, | |
| states: { | |
| idle: { | |
| on: { | |
| START: 'active.swimming', | |
| } | |
| }, | |
| dnf: {}, | |
| finished: {}, | |
| active: { | |
| states: { | |
| swimming: { | |
| on: { | |
| TRANSITION: 'cycling', | |
| PULL_OUT: '#triathlonMachine.dnf', | |
| } | |
| }, | |
| cycling: { | |
| on: { | |
| TRANSITION: 'running', | |
| PULL_OUT: '#triathlonMachine.dnf', | |
| } | |
| }, | |
| running: { | |
| on: { | |
| FINISH: '#triathlonMachine.finished', | |
| PULL_OUT: '#triathlonMachine.dnf', | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment