import { ClassKit, CCKContext, CCKBinaryItem, CCKQuantityItem, CCKScoreItem, CCKContextTopic, CCKContextType, CCKBinaryType } from '@ionic-native/class-kit/ngx';
constructor( ..., private classKit: ClassKit) {
platform.ready().then(() => {
classKit.initContextsFromXml("classkitplugin://")
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
});
}
...
const context: CCKContext = {
identifierPath: ["parent_title_one", "child_one", "child_one_correct_quiz"],
title: "child one correct quiz",
type: CCKContextType.exercise,
topic: CCKContextTopic.science,
displayOrder: 0
};
this.classKit.addContext("classkitplugin://", context)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
this.classKit.removeContexts()
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
this.classKit.removeContext(["parent_title_one", "child_one", "child_one_correct_quiz"])
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
this.classKit.beginActivity(["parent_title_one", "child_two", "child_two_quiz"], false)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
this.classKit.setProgressRange(0, 0.66)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
this.classKit.setProgress(0.66)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
const binaryItem: CCKBinaryItem = {
identifier: "child_two_quiz_IDENTIFIER_1",
title: "CHILD TWO QUIZ 1",
type: CCKBinaryType.trueFalse,
isCorrect: isCorrect,
isPrimaryActivityItem: false
};
this.classKit.setBinaryItem(binaryItem)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
const scoreItem: CCKScoreItem = {
identifier: "total_score",
title: "Total Score :-)",
score: 0.66,
maxScore: 1.0,
isPrimaryActivityItem: true
};
this.classKit.setScoreItem(scoreItem)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));
const quantityItem: CCKQuantityItem = {
identifier: "quantity_item_hints",
title: "Hints",
quantity: 12,
isPrimaryActivityItem: false
};
this.classKit.setQuantityItem(quantityItem)
.then(() => console.log("success"))
.catch(e => console.log("error: ", e));