Last active
          September 21, 2020 22:42 
        
      - 
      
- 
        Save signaes/7c3351201ea9b2adfc2d92b3d9034551 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
    
  
  
    
  | // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions | |
| // - XState (all XState exports) | |
| const defineWorkoutMachine = Machine({ | |
| id: 'defineWorkoutMachine', | |
| initial: 'idle', | |
| context: { | |
| }, | |
| states: { | |
| idle: { | |
| on: { | |
| 'EXERCISE.ADD': 'idle', | |
| 'EXERCISE.REMOVE': 'idle', | |
| 'EXERCISE.DRAG': 'idle', | |
| 'EXERCISE.DETAILS.UPDATE': 'idle', | |
| 'EXERCISE.DETAILS.SAVE': 'updating', | |
| TOGGLE: 'toggling', | |
| CREATE: 'creating', | |
| UPDATE: 'updating', | |
| DELETE: 'deleting', | |
| CANCEL: 'complete', | |
| } | |
| }, | |
| creating: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| DONE: '#defineWorkoutMachine.idle', | |
| ERROR: '.' | |
| } | |
| }, | |
| error: { | |
| on: { | |
| RETRY: 'idle' | |
| } | |
| } | |
| } | |
| }, | |
| updating: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| DONE: '#defineWorkoutMachine.idle', | |
| ERROR: '.' | |
| } | |
| }, | |
| error: { | |
| on: { | |
| RETRY: 'idle' | |
| } | |
| } | |
| } | |
| }, | |
| toggling: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| DONE: '#defineWorkoutMachine.idle', | |
| ERROR: '.' | |
| } | |
| }, | |
| error: { | |
| on: { | |
| RETRY: 'idle' | |
| } | |
| } | |
| } | |
| }, | |
| deleting: { | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| DONE: '#defineWorkoutMachine.complete', | |
| ERROR: '.' | |
| } | |
| }, | |
| error: { | |
| on: { | |
| RETRY: 'idle' | |
| } | |
| } | |
| } | |
| }, | |
| complete: { | |
| type: 'final' | |
| } | |
| } | |
| }); | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment