Created
          April 9, 2021 23:34 
        
      - 
      
- 
        Save Valkendorm/bd8acacfb5d018a3ef7ec1e3fd56bdf3 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 doorMachine = Machine({ | |
| states: { | |
| door: { | |
| id: "door", | |
| initial: 'closed', | |
| states: { | |
| closed: {}, | |
| opened: { | |
| on: { | |
| CLOSE_DOOR: 'closed' | |
| } | |
| } | |
| } | |
| }, | |
| handle: { | |
| id: "handle", | |
| initial: 'released', | |
| states: { | |
| released: { | |
| initial: 'unlocked', | |
| states: { | |
| unlocked: { | |
| on: { | |
| TOGGLE_LOCK: 'locked', | |
| TURN_HANDLE: '#handle.turned' | |
| } | |
| }, | |
| locked: { | |
| on: { | |
| TOGGLE_LOCK: 'unlocked' | |
| }} | |
| } | |
| }, | |
| turned: { | |
| on: { | |
| OPEN_DOOR: '#door.opened', | |
| RELEASE_HANDLE: 'released' | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| type: 'parallel' | |
| }) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment