Checklist
Control and listen to checklist behavior via the Kompassify Player API.
Checklist is ready event
It is highly recommended to wait for the checklist to be fully loaded before calling the rest of the API functions.
The event KOMPASSIFY_CHECKLIST_V2_IS_READY is dispatched once the checklist is loaded and ready to be used.
window.addEventListener('message', function (event) {
if (event.data.TYPE === "KOMPASSIFY_CHECKLIST_V2_IS_READY") {
// Do your stuff here
}
});
Mark a checklist task as complete
If you have chosen to disable the "Mark Step as completed after click" option in the task config menu, you can still set the checklist task as completed via JavaScript:
window.kompassifyChecklistV2.markTaskAsComplete(taskNumber);
Or via window.postMessage:
window.postMessage({
TYPE: "KOMPASSIFY_CHECKLIST_V2_MARK_TASK_AS_COMPLETE",
taskNumber: taskNumber
});
Parameters
| Property | Type | Description |
|---|---|---|
| taskNumber | Number | The index of the checklist task. 0 is the first task, 1 is the second task, etc. |
Start a checklist
You can start a specific checklist by calling:
window.kompassifyChecklistV2.startChecklist(checklistUuid);
Parameters
| Property | Type | Description |
|---|---|---|
| Checklistuuid | String | The UUID of the checklist you want to start. You can find it in the URL of the dashboard after selecting a checklist. |
Listening to checklist events
Message events are dispatched when a task in the checklist is completed or started:
window.addEventListener('message', function (event) {
if (event.data.TYPE === "KOMPASSIFY_CHECKLIST_V2_TASK_COMPLETED") {
console.log('The Task number', event.data.taskNumber, 'of the checklist with the uuid ', event.data.checklistUuid, 'was completed.');
}
});
window.addEventListener('message', function (event) {
if (event.data.TYPE === "KOMPASSIFY_CHECKLIST_V2_TASK_STARTED") {
console.log('The Task number', event.data.taskNumber, 'of the checklist with the uuid ', event.data.checklistUuid, 'was started.');
}
});