new ContentType()
H5P.ContentType is a base class for all content types. Used by newRunnable()
Functions here may be overridable by the libraries. In special cases,
it is also possible to override H5P.ContentType on a global level.
NOTE that this doesn't actually 'extend' the event dispatcher but instead
it creates a single instance which all content types shares as their base
prototype. (in some cases this may be the root of strange event behavior)
Extends
Methods
-
createXAPIEventTemplate(verb, extra) → {H5P.XAPIEvent}
-
Helper function to create event templates added to the EventDispatcher. Will in the future be used to add representations of the questions to the statements.
Parameters:
Name Type Argument Description verb
string Verb id in short form extra
Object <optional>
Extra values to be added to the statement - Inherited From:
Returns:
Instance- Type
- H5P.XAPIEvent
-
off(type, listener)
-
Remove event listener. If no listener is specified, all listeners will be removed.
Parameters:
Name Type Description type
string Event type listener
H5P.EventCallback Event listener - Inherited From:
Throws:
-
listener must be a function
- Type
- TypeError
-
on(type, listener, thisArg)
-
Add new event listener.
Parameters:
Name Type Argument Description type
string Event type listener
H5P.EventCallback Event listener thisArg
Object <optional>
Optionally specify the this value when calling listener. - Inherited From:
Throws:
-
listener must be a function
- Type
- TypeError
-
once(type, listener, thisArg)
-
Add new event listener that will be fired only once.
Parameters:
Name Type Description type
string Event type listener
H5P.EventCallback Event listener thisArg
Object Optionally specify the this value when calling listener. - Inherited From:
Throws:
-
listener must be a function
- Type
- TypeError
-
trigger(event, eventData, extras)
-
Dispatch event.
Parameters:
Name Type Argument Description event
string | H5P.Event Event object or event type as string eventData
* <optional>
Custom event data(used when event type as string is used as first argument). extras
Object <optional>
Properties
Name Type Argument Description bubbles
boolean <optional>
external
boolean <optional>
- Inherited From:
-
triggerXAPI(verb, extra)
-
Helper function for triggering xAPI added to the EventDispatcher.
Parameters:
Name Type Argument Description verb
string The short id of the verb we want to trigger extra
Oject <optional>
Extra properties for the xAPI statement - Inherited From:
-
triggerXAPICompleted(score, maxScore, success)
-
Helper function to create xAPI completed events DEPRECATED - USE triggerXAPIScored instead
Parameters:
Name Type Description score
number Will be set as the 'raw' value of the score object maxScore
number will be set as the "max" value of the score object success
boolean will be set as the "success" value of the result object - Inherited From:
- Deprecated:
-
- since 1.5, use triggerXAPIScored instead.
-
triggerXAPIScored(score, maxScore, verb, completion, success)
-
Helper function to create scored xAPI events
Parameters:
Name Type Description score
number Will be set as the 'raw' value of the score object maxScore
number Will be set as the "max" value of the score object verb
string Short form of adl verb completion
boolean Is this a statement from a completed activity? success
boolean Is this a statement from an activity that was done successfully? - Inherited From: