H5P Guides

H5P.XAPIEvent

Class H5P.XAPIEvent

Class Summary
Constructor AttributesConstructor Name and Description
 
Constructor for xAPI events
Field Summary
Field AttributesField Name and Description
<static>  
H5P.XAPIEvent.allowedXAPIVerbs
List of verbs defined at http://adlnet.gov/expapi/verbs/
Method Summary
Method AttributesMethod Name and Description
 
Get the max value of the result - score part of the statement
 
Get the raw value of the result - score part of the statement
 
getVerb(full)
Helperfunction to get the statements verb id
 
Figure out if a property exists in the statement and return it
 
Helper function to set the actor, email and name will be added automatically
 
setObject(instance)
Helperfunction to set the object part of the statement.
 
setScoredResult(score, maxScore)
Helperfunction to set scored result statements
 
setVerb(verb)
Helperfunction to set a verb.
Class Detail
H5P.XAPIEvent()
Constructor for xAPI events
Field Detail
<static> {Array} H5P.XAPIEvent.allowedXAPIVerbs
List of verbs defined at http://adlnet.gov/expapi/verbs/
Method Detail
{int} getMaxScore()
Get the max value of the result - score part of the statement
Returns:
{int} the max score, or null if not defined

{int} getScore()
Get the raw value of the result - score part of the statement
Returns:
{int} the max score, or null if not defined

{string} getVerb(full)
Helperfunction to get the statements verb id
Parameters:
{boolean} full
if true the full verb id prefixed by http://adlnet.gov/expapi/verbs/ will be returned
Returns:
{string} - Verb or null if no verb with an id has been defined

getVerifiedStatementValue(keys)
Figure out if a property exists in the statement and return it
Parameters:
{array} keys
List describing the property we're looking for. For instance ['result', 'score', 'raw'] for result.score.raw
Returns:
the value of the property if it is set, null otherwise

setActor()
Helper function to set the actor, email and name will be added automatically

setObject(instance)
Helperfunction to set the object part of the statement. The id is found automatically (the url to the content)
Parameters:
{object} instance
- the H5P instance

setScoredResult(score, maxScore)
Helperfunction to set scored result statements
Parameters:
{int} score
{int} maxScore

setVerb(verb)
Helperfunction to set a verb.
Parameters:
{string} verb
Verb in short form, one of the verbs defined at http://adlnet.gov/expapi/verbs/