jssm 5.61.3 → 5.61.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,18 +42,39 @@ log( TrafficLight.state() ); // 'Green'
42
42
  What if the notation supported action names easily?
43
43
 
44
44
  ```javascript
45
- const TrafficLightWithActions = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`;
45
+ const TLWA = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`; // TLWA = Traffic Light With Actions
46
46
 
47
- log( TrafficLightWithActions.state() ); // 'Red'
47
+ log( TLWA.state() ); // 'Red'
48
48
 
49
- TrafficLightWithActions.action('next'); // true
50
- log( TrafficLightWithActions.state() ); // 'Green'
49
+ TLWA.action('next'); // true
50
+ log( TLWA.state() ); // 'Green'
51
51
 
52
- TrafficLightWithActions.action('next'); // true
53
- log( TrafficLightWithActions.state() ); // 'Yellow'
52
+ TLWA.action('next'); // true
53
+ log( TLWA.state() ); // 'Yellow'
54
54
 
55
- TrafficLightWithActions.action('next'); // true
56
- log( TrafficLightWithActions.state() ); // 'Red'
55
+ TLWA.action('next'); // true
56
+ log( TLWA.state() ); // 'Red'
57
+ ```
58
+
59
+ <br/>
60
+
61
+ What if integration with the outside was straightforward?
62
+
63
+ ```javascript
64
+ const MTL = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;` // MTL = More Traffic Lights
65
+ .hook('Red', 'Green', () => console.log('GO GO GO')) // node will jump the gun when you hit return, though
66
+ .hook_entry('Red', () => console.log('STOP')); // so put it on one line in node
67
+
68
+ log( MTL.state() ); // 'Red'
69
+
70
+ TLWA.action('next'); // true, console logs 'GO GO GO'
71
+ log( TLWA.state() ); // 'Green'
72
+
73
+ TLWA.action('next'); // true
74
+ log( TLWA.state() ); // 'Yellow'
75
+
76
+ TLWA.action('next'); // true, console logs 'STOP'
77
+ log( TLWA.state() ); // 'Red'
57
78
  ```
58
79
 
59
80
  <br/>
@@ -61,11 +82,11 @@ log( TrafficLightWithActions.state() ); // 'Red'
61
82
  What if the machine followed JS standards, and distinguished refusals as `false` from mistakes as `throw`n?
62
83
 
63
84
  ```javascript
64
- const AnotherTrafficLight = sm`Red -> Green -> Yellow -> Red;`;
85
+ const ATL = sm`Red -> Green -> Yellow -> Red;`; // ATL = Another Traffic Light
65
86
 
66
- log( AnotherTrafficLight.state() ); // 'Red' - uses 1st state unless told otherwise
67
- AnotherTrafficLight.transition('Yellow'); // false (Yellow isn't allowed from Red)
68
- AnotherTrafficLight.transition('Blue'); // throws (Blue isn't a state at all)
87
+ log( ATL.state() ); // 'Red' - uses 1st state unless told otherwise
88
+ ATL.transition('Yellow'); // false (Yellow isn't allowed from Red)
89
+ ATL.transition('Blue'); // throws (Blue isn't a state at all)
69
90
  ```
70
91
 
71
92
  <br/>
@@ -1,2 +1,2 @@
1
- const version = "5.61.3";
1
+ const version = "5.61.4";
2
2
  export { version };