traitify-widgets 3.0.0-alpha.4 → 3.0.0-alpha.40
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 +22 -6
- package/build/traitify.js +1 -1
- package/build/traitify.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -117,8 +117,27 @@ export default function Personality({id}) {
|
|
|
117
117
|
|
|
118
118
|
## Events
|
|
119
119
|
|
|
120
|
-
Most components trigger an initialized and updated event
|
|
120
|
+
- Most components trigger an initialized and updated event
|
|
121
|
+
- Event handlers must be set before the render command or they will not be called
|
|
122
|
+
- Some events may fire multiple times, once for each target specified (such as the Survey and Results)
|
|
121
123
|
|
|
124
|
+
The widgets are capable of showing multiple kinds of surveys to users in order to satisfy benchmark requirements. To handle the event when all surveys have been finished you should use this event:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Traitify.listener.on("Surveys.finished", (surveys) => {
|
|
128
|
+
console.log("Surveys.finished", surveys);
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
To handle the event when each survey has been finished, maybe to record total progress in a backend system:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
Traitify.listener.on("Survey.finished", ({response}) => {
|
|
136
|
+
console.log("Survey.finished", response);
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Here are some other events that can be handled:
|
|
122
141
|
```
|
|
123
142
|
Traitify.listener.on("Survey.initialized", () => {
|
|
124
143
|
console.log("Survey.initialized");
|
|
@@ -129,14 +148,11 @@ Traitify.listener.on("Survey.updated", () => {
|
|
|
129
148
|
});
|
|
130
149
|
|
|
131
150
|
Traitify.listener.on("Survey.updateSlide", ({response}) => {
|
|
132
|
-
console.log("Survey.
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
Traitify.listener.on("Survey.finished", ({response}) => {
|
|
136
|
-
console.log("Survey.finished", response);
|
|
151
|
+
console.log("Survey.updateSlide", response);
|
|
137
152
|
});
|
|
138
153
|
```
|
|
139
154
|
|
|
155
|
+
|
|
140
156
|
## Options
|
|
141
157
|
|
|
142
158
|
### Internationalization Options
|