- Notifications
You must be signed in to change notification settings - Fork0
Traffic Light State Machine in Microstates
microstates/trafficlight
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
CheckoutMicrostates.js Project if you haven't already.
This application is an example of using Microstates to build State Machines. This is one of the popular examples of state machines but it adds a small Microstaty twist. It shows how you an compose state machines and transition state one state machine based on another.
In this example, hasTrafficLight state machine and aPerson state machine. When the traffic light is red, the pedastrian stands and waits, runs when it's yellow and walks when it's green. Both state machines are composed into anIntersection state machine.
The file structure has/src/states directory where all of the state machines and their tests are./src/components directory has components for rendering the state machines. The state machines are brought to live by anInterval component which calls Intersection's tick transition every minute.
- Clone this repo
git clone git@github.com:microstates/trafficlight.git - Install npm dependencies with
yarnornpm install yarn startornpm startto start the server
You can run tests withyarn test ornpm test.
PRs and Questions are welcome.
About
Traffic Light State Machine in Microstates
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.