Last active
December 15, 2019 05:45
-
-
Save danielsdesk/db0e3be6cb9d3d7e5977b7485b61d181 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 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' | |
} | |
} | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment