jssm 5.65.5 → 5.65.9
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/dist/es6/jssm.d.ts +78 -0
- package/dist/es6/jssm.js +78 -0
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +78 -0
- package/package.json +2 -2
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -213,9 +213,60 @@ declare class Machine<mDT> {
|
|
|
213
213
|
_forced_transition_hook: HookHandler | undefined;
|
|
214
214
|
_any_transition_hook: HookHandler | undefined;
|
|
215
215
|
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name }: JssmGenericConfig<mDT>);
|
|
216
|
+
/********
|
|
217
|
+
*
|
|
218
|
+
* Internal method for fabricating states. Not meant for external use.
|
|
219
|
+
*
|
|
220
|
+
*/
|
|
216
221
|
_new_state(state_config: JssmGenericState): StateType;
|
|
222
|
+
/*********
|
|
223
|
+
*
|
|
224
|
+
* Get the current state of a machine.
|
|
225
|
+
*
|
|
226
|
+
* ```typescript
|
|
227
|
+
* import * as jssm from './jssm';
|
|
228
|
+
*
|
|
229
|
+
* const switch = jssm.from('on <=> off;');
|
|
230
|
+
* console.log( switch.state() ); // 'on'
|
|
231
|
+
*
|
|
232
|
+
* switch.transition('off');
|
|
233
|
+
* console.log( switch.state() ); // 'off'
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
*/
|
|
217
237
|
state(): StateType;
|
|
238
|
+
/********
|
|
239
|
+
*
|
|
240
|
+
* Check whether a given state is final (either has no exits or is marked
|
|
241
|
+
* `complete`.)
|
|
242
|
+
*
|
|
243
|
+
* ```typescript
|
|
244
|
+
* import { sm, state_is_final } from './jssm';
|
|
245
|
+
*
|
|
246
|
+
* const final_test = sm`first -> second;`;
|
|
247
|
+
*
|
|
248
|
+
* console.log( final_test.state_is_final('first') ); // false
|
|
249
|
+
* console.log( final_test.state_is_final('second') ); // true
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
*/
|
|
218
253
|
state_is_final(whichState: StateType): boolean;
|
|
254
|
+
/********
|
|
255
|
+
*
|
|
256
|
+
* Check whether the current state is final (either has no exits or is marked
|
|
257
|
+
* `complete`.)
|
|
258
|
+
*
|
|
259
|
+
* ```typescript
|
|
260
|
+
* import { sm, state_is_final } from './jssm';
|
|
261
|
+
*
|
|
262
|
+
* const final_test = sm`first -> second;`;
|
|
263
|
+
*
|
|
264
|
+
* console.log( final_test.is_final() ); // false
|
|
265
|
+
* state.transition('second');
|
|
266
|
+
* console.log( final_test.is_final() ); // true
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
*/
|
|
219
270
|
is_final(): boolean;
|
|
220
271
|
graph_layout(): string;
|
|
221
272
|
dot_preamble(): string;
|
|
@@ -232,8 +283,35 @@ declare class Machine<mDT> {
|
|
|
232
283
|
state_declarations(): Map<StateType, JssmStateDeclaration>;
|
|
233
284
|
fsl_version(): string;
|
|
234
285
|
machine_state(): JssmMachineInternalState<mDT>;
|
|
286
|
+
/*********
|
|
287
|
+
*
|
|
288
|
+
* List all the states known by the machine. Please note that the order of
|
|
289
|
+
* these states is not guaranteed.
|
|
290
|
+
*
|
|
291
|
+
* ```typescript
|
|
292
|
+
* import * as jssm from './jssm';
|
|
293
|
+
*
|
|
294
|
+
* const switch = jssm.from('on <=> off;');
|
|
295
|
+
* console.log( switch.states() ); // ['on', 'off']
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
*/
|
|
235
299
|
states(): Array<StateType>;
|
|
236
300
|
state_for(whichState: StateType): JssmGenericState;
|
|
301
|
+
/*********
|
|
302
|
+
*
|
|
303
|
+
* Check whether the machine knows a given state.
|
|
304
|
+
*
|
|
305
|
+
* ```typescript
|
|
306
|
+
* import * as jssm from './jssm';
|
|
307
|
+
*
|
|
308
|
+
* const switch = jssm.from('on <=> off;');
|
|
309
|
+
|
|
310
|
+
* console.log( switch.has_state('off') ); // true
|
|
311
|
+
* console.log( switch.has_state('dance') ); // false
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
*/
|
|
237
315
|
has_state(whichState: StateType): boolean;
|
|
238
316
|
list_edges(): Array<JssmTransition<mDT>>;
|
|
239
317
|
list_named_transitions(): Map<StateType, number>;
|
package/dist/es6/jssm.js
CHANGED
|
@@ -643,6 +643,11 @@ class Machine {
|
|
|
643
643
|
}
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
|
+
/********
|
|
647
|
+
*
|
|
648
|
+
* Internal method for fabricating states. Not meant for external use.
|
|
649
|
+
*
|
|
650
|
+
*/
|
|
646
651
|
_new_state(state_config) {
|
|
647
652
|
if (this._states.has(state_config.name)) {
|
|
648
653
|
throw new JssmError(this, `state ${JSON.stringify(state_config.name)} already exists`);
|
|
@@ -650,6 +655,21 @@ class Machine {
|
|
|
650
655
|
this._states.set(state_config.name, state_config);
|
|
651
656
|
return state_config.name;
|
|
652
657
|
}
|
|
658
|
+
/*********
|
|
659
|
+
*
|
|
660
|
+
* Get the current state of a machine.
|
|
661
|
+
*
|
|
662
|
+
* ```typescript
|
|
663
|
+
* import * as jssm from './jssm';
|
|
664
|
+
*
|
|
665
|
+
* const switch = jssm.from('on <=> off;');
|
|
666
|
+
* console.log( switch.state() ); // 'on'
|
|
667
|
+
*
|
|
668
|
+
* switch.transition('off');
|
|
669
|
+
* console.log( switch.state() ); // 'off'
|
|
670
|
+
* ```
|
|
671
|
+
*
|
|
672
|
+
*/
|
|
653
673
|
state() {
|
|
654
674
|
return this._state;
|
|
655
675
|
}
|
|
@@ -660,9 +680,40 @@ class Machine {
|
|
|
660
680
|
return true; // todo whargarbl
|
|
661
681
|
}
|
|
662
682
|
*/
|
|
683
|
+
/********
|
|
684
|
+
*
|
|
685
|
+
* Check whether a given state is final (either has no exits or is marked
|
|
686
|
+
* `complete`.)
|
|
687
|
+
*
|
|
688
|
+
* ```typescript
|
|
689
|
+
* import { sm, state_is_final } from './jssm';
|
|
690
|
+
*
|
|
691
|
+
* const final_test = sm`first -> second;`;
|
|
692
|
+
*
|
|
693
|
+
* console.log( final_test.state_is_final('first') ); // false
|
|
694
|
+
* console.log( final_test.state_is_final('second') ); // true
|
|
695
|
+
* ```
|
|
696
|
+
*
|
|
697
|
+
*/
|
|
663
698
|
state_is_final(whichState) {
|
|
664
699
|
return ((this.state_is_terminal(whichState)) && (this.state_is_complete(whichState)));
|
|
665
700
|
}
|
|
701
|
+
/********
|
|
702
|
+
*
|
|
703
|
+
* Check whether the current state is final (either has no exits or is marked
|
|
704
|
+
* `complete`.)
|
|
705
|
+
*
|
|
706
|
+
* ```typescript
|
|
707
|
+
* import { sm, state_is_final } from './jssm';
|
|
708
|
+
*
|
|
709
|
+
* const final_test = sm`first -> second;`;
|
|
710
|
+
*
|
|
711
|
+
* console.log( final_test.is_final() ); // false
|
|
712
|
+
* state.transition('second');
|
|
713
|
+
* console.log( final_test.is_final() ); // true
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
*/
|
|
666
717
|
is_final() {
|
|
667
718
|
// return ((!this.is_changing()) && this.state_is_final(this.state()));
|
|
668
719
|
return this.state_is_final(this.state());
|
|
@@ -727,6 +778,19 @@ class Machine {
|
|
|
727
778
|
return false; // todo whargarbl
|
|
728
779
|
}
|
|
729
780
|
*/
|
|
781
|
+
/*********
|
|
782
|
+
*
|
|
783
|
+
* List all the states known by the machine. Please note that the order of
|
|
784
|
+
* these states is not guaranteed.
|
|
785
|
+
*
|
|
786
|
+
* ```typescript
|
|
787
|
+
* import * as jssm from './jssm';
|
|
788
|
+
*
|
|
789
|
+
* const switch = jssm.from('on <=> off;');
|
|
790
|
+
* console.log( switch.states() ); // ['on', 'off']
|
|
791
|
+
* ```
|
|
792
|
+
*
|
|
793
|
+
*/
|
|
730
794
|
states() {
|
|
731
795
|
return Array.from(this._states.keys());
|
|
732
796
|
}
|
|
@@ -739,6 +803,20 @@ class Machine {
|
|
|
739
803
|
throw new JssmError(this, 'No such state', { requested_state: whichState });
|
|
740
804
|
}
|
|
741
805
|
}
|
|
806
|
+
/*********
|
|
807
|
+
*
|
|
808
|
+
* Check whether the machine knows a given state.
|
|
809
|
+
*
|
|
810
|
+
* ```typescript
|
|
811
|
+
* import * as jssm from './jssm';
|
|
812
|
+
*
|
|
813
|
+
* const switch = jssm.from('on <=> off;');
|
|
814
|
+
|
|
815
|
+
* console.log( switch.has_state('off') ); // true
|
|
816
|
+
* console.log( switch.has_state('dance') ); // false
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
*/
|
|
742
820
|
has_state(whichState) {
|
|
743
821
|
return this._states.get(whichState) !== undefined;
|
|
744
822
|
}
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.65.
|
|
1
|
+
const version = "5.65.9";
|
|
2
2
|
export { version };
|