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 verbstring Verb id in short form extraObject <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 typestring Event type listenerH5P.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 typestring Event type listenerH5P.EventCallback Event listener thisArgObject <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 typestring Event type listenerH5P.EventCallback Event listener thisArgObject 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 eventstring | 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). extrasObject <optional>
Properties
Name Type Argument Description bubblesboolean <optional>
externalboolean <optional>
- Inherited From:
-
triggerXAPI(verb, extra)
-
Helper function for triggering xAPI added to the EventDispatcher.
Parameters:
Name Type Argument Description verbstring The short id of the verb we want to trigger extraOject <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 scorenumber Will be set as the 'raw' value of the score object maxScorenumber will be set as the "max" value of the score object successboolean 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 scorenumber Will be set as the 'raw' value of the score object maxScorenumber Will be set as the "max" value of the score object verbstring Short form of adl verb completionboolean Is this a statement from a completed activity? successboolean Is this a statement from an activity that was done successfully? - Inherited From: