jssm 5.65.5 → 5.65.7

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.
@@ -214,6 +214,21 @@ declare class Machine<mDT> {
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
216
  _new_state(state_config: JssmGenericState): StateType;
217
+ /*********
218
+ *
219
+ * Get the current state of a machine.
220
+ *
221
+ * ```typescript
222
+ * import * as jssm from './jssm';
223
+ *
224
+ * const switch = jssm.from('on <=> off;');
225
+ * console.log( switch.state() ); // 'on'
226
+ *
227
+ * switch.transition('off');
228
+ * console.log( switch.state() ); // 'off'
229
+ * ```
230
+ *
231
+ */
217
232
  state(): StateType;
218
233
  state_is_final(whichState: StateType): boolean;
219
234
  is_final(): boolean;
@@ -232,8 +247,35 @@ declare class Machine<mDT> {
232
247
  state_declarations(): Map<StateType, JssmStateDeclaration>;
233
248
  fsl_version(): string;
234
249
  machine_state(): JssmMachineInternalState<mDT>;
250
+ /*********
251
+ *
252
+ * List all the states known by the machine. Please note that the order of
253
+ * these states is not guaranteed.
254
+ *
255
+ * ```typescript
256
+ * import * as jssm from './jssm';
257
+ *
258
+ * const switch = jssm.from('on <=> off;');
259
+ * console.log( switch.states() ); // ['on', 'off']
260
+ * ```
261
+ *
262
+ */
235
263
  states(): Array<StateType>;
236
264
  state_for(whichState: StateType): JssmGenericState;
265
+ /*********
266
+ *
267
+ * Check whether the machine knows a given state.
268
+ *
269
+ * ```typescript
270
+ * import * as jssm from './jssm';
271
+ *
272
+ * const switch = jssm.from('on <=> off;');
273
+
274
+ * console.log( switch.has_state('off') ); // true
275
+ * console.log( switch.has_state('dance') ); // false
276
+ * ```
277
+ *
278
+ */
237
279
  has_state(whichState: StateType): boolean;
238
280
  list_edges(): Array<JssmTransition<mDT>>;
239
281
  list_named_transitions(): Map<StateType, number>;
package/dist/es6/jssm.js CHANGED
@@ -650,6 +650,21 @@ class Machine {
650
650
  this._states.set(state_config.name, state_config);
651
651
  return state_config.name;
652
652
  }
653
+ /*********
654
+ *
655
+ * Get the current state of a machine.
656
+ *
657
+ * ```typescript
658
+ * import * as jssm from './jssm';
659
+ *
660
+ * const switch = jssm.from('on <=> off;');
661
+ * console.log( switch.state() ); // 'on'
662
+ *
663
+ * switch.transition('off');
664
+ * console.log( switch.state() ); // 'off'
665
+ * ```
666
+ *
667
+ */
653
668
  state() {
654
669
  return this._state;
655
670
  }
@@ -727,6 +742,19 @@ class Machine {
727
742
  return false; // todo whargarbl
728
743
  }
729
744
  */
745
+ /*********
746
+ *
747
+ * List all the states known by the machine. Please note that the order of
748
+ * these states is not guaranteed.
749
+ *
750
+ * ```typescript
751
+ * import * as jssm from './jssm';
752
+ *
753
+ * const switch = jssm.from('on <=> off;');
754
+ * console.log( switch.states() ); // ['on', 'off']
755
+ * ```
756
+ *
757
+ */
730
758
  states() {
731
759
  return Array.from(this._states.keys());
732
760
  }
@@ -739,6 +767,20 @@ class Machine {
739
767
  throw new JssmError(this, 'No such state', { requested_state: whichState });
740
768
  }
741
769
  }
770
+ /*********
771
+ *
772
+ * Check whether the machine knows a given state.
773
+ *
774
+ * ```typescript
775
+ * import * as jssm from './jssm';
776
+ *
777
+ * const switch = jssm.from('on <=> off;');
778
+
779
+ * console.log( switch.has_state('off') ); // true
780
+ * console.log( switch.has_state('dance') ); // false
781
+ * ```
782
+ *
783
+ */
742
784
  has_state(whichState) {
743
785
  return this._states.get(whichState) !== undefined;
744
786
  }
@@ -1,2 +1,2 @@
1
- const version = "5.65.5";
1
+ const version = "5.65.7";
2
2
  export { version };