jssm 5.65.11 → 5.65.12
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 +76 -23
- package/dist/es6/jssm.js +76 -24
- 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 +76 -23
- package/package.json +1 -1
package/jssm.d.ts
CHANGED
|
@@ -318,28 +318,30 @@ declare class Machine<mDT> {
|
|
|
318
318
|
* Lists all edges of a machine.
|
|
319
319
|
*
|
|
320
320
|
* ```typescript
|
|
321
|
+
* import { sm } from 'jssm';
|
|
322
|
+
*
|
|
321
323
|
* const lswitch = sm`on 'toggle' <=> 'toggle' off;`;
|
|
322
324
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
325
|
+
* lswitch.list_edges();
|
|
326
|
+
* [
|
|
327
|
+
* {
|
|
328
|
+
* from: 'on',
|
|
329
|
+
* to: 'off',
|
|
330
|
+
* kind: 'main',
|
|
331
|
+
* forced_only: false,
|
|
332
|
+
* main_path: true,
|
|
333
|
+
* action: 'toggle'
|
|
334
|
+
* },
|
|
335
|
+
* {
|
|
336
|
+
* from: 'off',
|
|
337
|
+
* to: 'on',
|
|
338
|
+
* kind: 'main',
|
|
339
|
+
* forced_only: false,
|
|
340
|
+
* main_path: true,
|
|
341
|
+
* action: 'toggle'
|
|
342
|
+
* }
|
|
343
|
+
* ]
|
|
344
|
+
* ```
|
|
343
345
|
*
|
|
344
346
|
*/
|
|
345
347
|
list_edges(): Array<JssmTransition<mDT>>;
|
|
@@ -355,11 +357,14 @@ declare class Machine<mDT> {
|
|
|
355
357
|
* exit. The order of each sublist is not defined. A node could appear in
|
|
356
358
|
* both lists.
|
|
357
359
|
*
|
|
358
|
-
*
|
|
360
|
+
* ```typescript
|
|
361
|
+
* import { sm } from 'jssm';
|
|
362
|
+
*
|
|
359
363
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
360
364
|
*
|
|
361
365
|
* light.state(); // 'red'
|
|
362
366
|
* light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] }
|
|
367
|
+
* ```
|
|
363
368
|
*
|
|
364
369
|
*/
|
|
365
370
|
list_transitions(whichState?: StateType): JssmTransitionList;
|
|
@@ -368,11 +373,14 @@ declare class Machine<mDT> {
|
|
|
368
373
|
* List all entrances attached to the current state. Please note that the
|
|
369
374
|
* order of the list is not defined.
|
|
370
375
|
*
|
|
371
|
-
*
|
|
376
|
+
* ```typescript
|
|
377
|
+
* import { sm } from 'jssm';
|
|
378
|
+
*
|
|
372
379
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
373
380
|
*
|
|
374
381
|
* light.state(); // 'red'
|
|
375
382
|
* light.list_entrances(); // [ 'yellow', 'off' ]
|
|
383
|
+
* ```
|
|
376
384
|
*
|
|
377
385
|
*/
|
|
378
386
|
list_entrances(whichState?: StateType): Array<StateType>;
|
|
@@ -381,11 +389,14 @@ declare class Machine<mDT> {
|
|
|
381
389
|
* List all exits attached to the current state. Please note that the order
|
|
382
390
|
* of the list is not defined.
|
|
383
391
|
*
|
|
384
|
-
*
|
|
392
|
+
* ```typescript
|
|
393
|
+
* import { sm } from 'jssm';
|
|
394
|
+
*
|
|
385
395
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
386
396
|
*
|
|
387
397
|
* light.state(); // 'red'
|
|
388
398
|
* light.list_exits(); // [ 'green', 'off' ]
|
|
399
|
+
* ```
|
|
389
400
|
*
|
|
390
401
|
*/
|
|
391
402
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
@@ -466,8 +477,50 @@ declare class Machine<mDT> {
|
|
|
466
477
|
hook_exit(from: string, handler: HookHandler): Machine<mDT>;
|
|
467
478
|
edges_between(from: string, to: string): JssmTransition<mDT>[];
|
|
468
479
|
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
|
|
480
|
+
/********
|
|
481
|
+
*
|
|
482
|
+
* Instruct the machine to complete an action.
|
|
483
|
+
*
|
|
484
|
+
* ```typescript
|
|
485
|
+
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
486
|
+
*
|
|
487
|
+
* light.state(); // 'red'
|
|
488
|
+
* light.action('next'); // true
|
|
489
|
+
* light.state(); // 'green'
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
*/
|
|
469
493
|
action(actionName: StateType, newData?: mDT): boolean;
|
|
494
|
+
/********
|
|
495
|
+
*
|
|
496
|
+
* Instruct the machine to complete a transition.
|
|
497
|
+
*
|
|
498
|
+
* ```typescript
|
|
499
|
+
* const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
500
|
+
*
|
|
501
|
+
* light.state(); // 'red'
|
|
502
|
+
* light.transition('green'); // true
|
|
503
|
+
* light.state(); // 'green'
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
*/
|
|
470
507
|
transition(newState: StateType, newData?: mDT): boolean;
|
|
508
|
+
/********
|
|
509
|
+
*
|
|
510
|
+
* Instruct the machine to complete a forced transition (which will reject if
|
|
511
|
+
* called with a normal {@link transition} call.)
|
|
512
|
+
*
|
|
513
|
+
* ```typescript
|
|
514
|
+
* const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
515
|
+
*
|
|
516
|
+
* light.state(); // 'red'
|
|
517
|
+
* light.transition('off'); // false
|
|
518
|
+
* light.state(); // 'red'
|
|
519
|
+
* light.force_transition('off'); // true
|
|
520
|
+
* light.state(); // 'off'
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
*/
|
|
471
524
|
force_transition(newState: StateType, newData?: mDT): boolean;
|
|
472
525
|
current_action_for(action: StateType): number;
|
|
473
526
|
current_action_edge_for(action: StateType): JssmTransition<mDT>;
|