From edb9906ab5649fe359d918dd137a327e706f9d01 Mon Sep 17 00:00:00 2001 From: John Haugeland Date: Thu, 18 May 2017 20:30:30 -0700 Subject: [PATCH] Update README.md --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 31189c57..3e2ab1bb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,30 @@ A Javascript state machine with a simple API. Well tested, and typed with Flowtype. MIT license. ## TL;DR +Specify finite state machines with a brief syntax. Run them. Derive charts from them. Save and load states. Make factories. Impress friends and loved ones. Cure corns and callouses. + +```javascript +const traffic_light = new jssm.machine({ + + initial_state : 'Red', + + transitions : [ + { action: 'Proceed', from:'Green', to:'Yellow' }, + { action: 'Proceed', from:'Yellow', to:'Red' }, + { action: 'Proceed', from:'Red', to:'Green' } + ] + +}); + +traffic_light.state(); // 'Red' +traffic_light.action('Proceed'); +traffic_light.state(); // 'Yellow' +traffic_light.action('Proceed'); +traffic_light.state(); // 'Green' +``` + +![](docs/ryg traffic light console screenshot.png) + ## Quick Start ## Why ## How To