dhenning
12/15/2019 - 5:38 AM

Generated by XState Viz: https://xstate.js.org/viz

Generated by XState Viz: https://xstate.js.org/viz


  // Available variables:
  // - Machine
  // - interpret
  // - assign
  // - send
  // - sendParent
  // - spawn
  // - raise
  // - actions
  // - XState (all XState exports)
const nestedLightMachine = Machine({
    id: 'light',
    initial: 'green',
    states: {
        green: {
            on: {
                TIMER: 'yellow'
            }
        },
        yellow: {
            on: {
                TIMER: 'red'
            }
        },

        red: {
            type: 'parallel',
            states: {
                walkSign: {
                    initial: 'solid',
                    states: {
                        solid: {
                            on: {
                                COUNTDOWN: 'flashing'
                            }
                        },
                        flashing: {
                            on: {
                                STOP_COUNTDOWN: 'solid'
                            }
                        }
                    }
                },
                pedestrian: {
                    initial: 'walk',
                    states: {
                        walk: {
                            on: {
                                COUNTDOWN: 'wait'
                            }
                        },
                        wait: {
                            on: {
                                STOP_COUNTDOWN: 'stop'
                            }
                        },
                        stop: {
                            type: 'final'
                        }
                    }
                }
            }
        }
    }
});