@resconet/qp-bridge 1.1.1-alpha.34 → 1.2.0-alpha.35

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.
Files changed (2) hide show
  1. package/README.md +78 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -53,6 +53,8 @@ await setAnswer("numericQuestion", 42);
53
53
  - [updateMediaItem](#updatemediaitem)
54
54
  - [updateMediaItem](#updatemediaitem)
55
55
  - [updateMediaItem](#updatemediaitem)
56
+ - [initOnSaveMessageHandler](#initonsavemessagehandler)
57
+ - [removeOnSaveMessageHandler](#removeonsavemessagehandler)
56
58
  - [setAnswer](#setanswer)
57
59
  - [getQuestion](#getquestion)
58
60
  - [setQuestion](#setquestion)
@@ -63,6 +65,8 @@ await setAnswer("numericQuestion", 42);
63
65
  - [saveQuestionnaire](#savequestionnaire)
64
66
  - [completeAndCloseQuestionnaire](#completeandclosequestionnaire)
65
67
  - [executeCustomCommand](#executecustomcommand)
68
+ - [onQuestionnaireLoaded](#onquestionnaireloaded)
69
+ - [onCommandExecuted](#oncommandexecuted)
66
70
  - [onSave](#onsave)
67
71
  - [fetchEntities](#fetchentities)
68
72
  - [getEntityById](#getentitybyid)
@@ -390,6 +394,18 @@ Returns:
390
394
 
391
395
  Updated MediaItem object.
392
396
 
397
+ ### initOnSaveMessageHandler
398
+
399
+ | Function | Type |
400
+ | ---------- | ---------- |
401
+ | `initOnSaveMessageHandler` | `() => void` |
402
+
403
+ ### removeOnSaveMessageHandler
404
+
405
+ | Function | Type |
406
+ | ---------- | ---------- |
407
+ | `removeOnSaveMessageHandler` | `() => void` |
408
+
393
409
  ### setAnswer
394
410
 
395
411
  Sets the answer for a specific question in the questionnaire.
@@ -642,6 +658,68 @@ console.log('Custom command executed successfully');
642
658
  ```
643
659
 
644
660
 
661
+ ### onQuestionnaireLoaded
662
+
663
+ Registers a handler function to be called when the questionnaire is fully loaded.
664
+ Useful for performing actions that depend on the questionnaire being ready.
665
+
666
+ | Function | Type |
667
+ | ---------- | ---------- |
668
+ | `onQuestionnaireLoaded` | `(handler: () => void) => { cancelSubscription: () => void; }` |
669
+
670
+ Parameters:
671
+
672
+ * `handler`: - A function to be called when the questionnaire is loaded.
673
+
674
+
675
+ Returns:
676
+
677
+ An object with a `cancelSubscription` method to unregister the handler.
678
+
679
+ Examples:
680
+
681
+ ```typescript
682
+ import { onQuestionnaireLoaded } from 'qp-bridge';
683
+ const { cancelSubscription } = onQuestionnaireLoaded(() => {
684
+ console.log('Questionnaire is fully loaded');
685
+ });
686
+
687
+ // To stop listening for questionnaire load events:
688
+ cancelSubscription();
689
+ ```
690
+
691
+
692
+ ### onCommandExecuted
693
+
694
+ Registers a handler function to be called when a command is executed.
695
+ Useful for reacting to custom command executions within the questionnaire.
696
+
697
+ | Function | Type |
698
+ | ---------- | ---------- |
699
+ | `onCommandExecuted` | `(handler: (commandName: string) => void) => { cancelSubscription: () => void; }` |
700
+
701
+ Parameters:
702
+
703
+ * `handler`: - A function that receives the name of the executed command.
704
+
705
+
706
+ Returns:
707
+
708
+ An object with a `cancelSubscription` method to unregister the handler.
709
+
710
+ Examples:
711
+
712
+ ```typescript
713
+ import { onCommandExecuted } from 'qp-bridge';
714
+ const { cancelSubscription } = onCommandExecuted((commandName) => {
715
+ console.log(`Command executed: ${commandName}`);
716
+ });
717
+
718
+ // To stop listening for command executions:
719
+ cancelSubscription();
720
+ ```
721
+
722
+
645
723
  ### onSave
646
724
 
647
725
  Registers a validator function to be called when a save event occurs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resconet/qp-bridge",
3
- "version": "1.1.1-alpha.34",
3
+ "version": "1.2.0-alpha.35",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",