Added utility function for figuriong out if event is from child [HFP-436]

JI-92-path-fix
Paal Joergensen 2017-01-04 16:16:28 +01:00
parent 2cc6c53da1
commit 738dced286
1 changed files with 10 additions and 0 deletions

View File

@ -248,6 +248,16 @@ H5P.XAPIEvent.prototype.getContentXAPIId = function (instance) {
return xAPIId;
};
/**
* Check if this event is sent from a child (i.e not from grandchild)
*
* @return {Boolean}
*/
H5P.XAPIEvent.prototype.isFromChild = function () {
var parentId = this.getVerifiedStatementValue(['context', 'contextActivities', 'parent', 0, 'id']);
return !parentId || parentId.indexOf('subContentId') === -1;
}
/**
* Figure out if a property exists in the statement and return it
*