"cmi5 defined" Statement methods
The core "cmi5 defined" statement methods for communicating module status.
initialize
Initializes the session, must be called before performing other methods.
Example
Parameters
Parameter
Type
Required
Description
sessionState
Object
false
An auth token and initialized date from a previous initialisation. Useful for persisting sessions across browser refreshes.
Returns
This returns a Promise
containing an array with the resulting statementId if successful, or undefined
if a sessionState
is provided.
complete
Completes the AU. Required for satisfaction if LaunchData.moveOn
is equal to Completed
, CompletedAndPassed
or CompletedOrPassed
.
Example
Parameters
Parameter
Type
Required
Description
Returns
This returns a Promise
containing an array with the resulting statementId if successful.
pass
Passes the AU. Required for satisfaction if LaunchData.moveOn
is equal to Passed
, CompletedAndPassed
or CompletedOrPassed
.
Examples
Example 1: Pass
Example 2: Pass with score
Example 3: Pass with score and objective
Parameters
Parameter
Type
Required
Description
objectiveOrOptions
false
The objective achieved by the learner or the additional options object.
Note: If using score and/or objective parameters, types for these are in @xapi/xapi
and must be installed as a dev dependency npm i --save-dev @xapi/xapi
.
Returns
This returns a Promise
containing an array with the resulting statementId if successful.
fail
Fails the AU. Required to mark the AU as Failed if LaunchData.moveOn
is equal to Passed
, CompletedAndPassed
or CompletedOrPassed
.
Examples
Example 1: Fail
Example 2: Fail with score
Parameters
Parameter
Type
Required
Description
Note: If using the score parameter, types for this are in @xapi/xapi
and must be installed as a dev dependency npm i --save-dev @xapi/xapi
.
Returns
This returns a Promise
containing an array with the resulting statementId if successful.
terminate
Terminates the session, must be the last method called before closing the window.
Example
Returns
This returns a Promise
containing an array with the resulting statementId if successful.
Last updated