Created
January 19, 2021 19:06
-
-
Save amogower/ad4bea1cd188395649166cb472295629 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 singleMachine = Machine({ | |
| id: 'single', | |
| initial: 'winOnly', | |
| context: { | |
| stake: '', | |
| }, | |
| states: { | |
| winOnly: { | |
| id: 'winOnly', | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| FOCUS_STAKE: 'changingStake', | |
| TOGGLE_EACH_WAY: '#eachWay', | |
| TOGGLE_SELECTIONS: 'expanded', | |
| }, | |
| }, | |
| changingStake: { | |
| on: { | |
| PLACE_BET: { | |
| actions: sendParent('PLACE_BET'), | |
| }, | |
| TOGGLE_EACH_WAY: '#eachWay', | |
| TOGGLE_SELECTIONS: 'expanded', | |
| }, | |
| }, | |
| expanded: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| FOCUS_STAKE: 'changingStake', | |
| TOGGLE_EACH_WAY: '#eachWay.expanded', | |
| TOGGLE_SELECTIONS: '#winOnly', | |
| }, | |
| }, | |
| changingStake: { | |
| on: { | |
| PLACE_BET: { | |
| actions: sendParent('PLACE_BET'), | |
| }, | |
| TOGGLE_EACH_WAY: '#eachWay.expanded', | |
| TOGGLE_SELECTIONS: '#winOnly', | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| eachWay: { | |
| id: 'eachWay', | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| FOCUS_STAKE: 'changingStake', | |
| TOGGLE_EACH_WAY: '#winOnly', | |
| TOGGLE_SELECTIONS: 'expanded', | |
| }, | |
| }, | |
| changingStake: { | |
| on: { | |
| PLACE_BET: { | |
| actions: sendParent('PLACE_BET'), | |
| }, | |
| TOGGLE_EACH_WAY: '#winOnly', | |
| TOGGLE_SELECTIONS: 'expanded', | |
| }, | |
| }, | |
| expanded: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| FOCUS_STAKE: 'changingStake', | |
| TOGGLE_EACH_WAY: '#winOnly.expanded', | |
| TOGGLE_SELECTIONS: '#eachWay', | |
| }, | |
| }, | |
| changingStake: { | |
| on: { | |
| PLACE_BET: { | |
| actions: sendParent('PLACE_BET'), | |
| }, | |
| TOGGLE_EACH_WAY: '#winOnly.expanded', | |
| TOGGLE_SELECTIONS: '#eachWay', | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment