diff --git a/js/h5p-x-api-event.js b/js/h5p-x-api-event.js index 212fe0b..cc7fd66 100644 --- a/js/h5p-x-api-event.js +++ b/js/h5p-x-api-event.js @@ -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 *