Add new languages for content type.
OptionalcurrentRemove event listener If no listener is specified, all listeners will be removed
Event type
Optionallistener: (event: TData) => void
Event listener
Add new event listener
Event type. If the event type is xAPI, the listener's event parameter will be of type XAPIEvent. Any dispatched XAPIEvent will trigger the xAPI event.
Event listener
OptionalthisArg: ThisType<unknown>
Optionally specify the listener's this value
Add new event listener that will be fired only once
Event type. If the event type is xAPI, the listener's event parameter will be of type XAPIEvent. Any dispatched XAPIEvent will trigger the xAPI event.
Event listener
OptionalthisArg: ThisType<unknown>
Optionally specify the listener's this value
Dispatch event
Event object or event type as string
OptionaleventData: TData
Custom event data (used when event type as string is used as first argument)
Optionalextras: { bubbles?: boolean; external?: boolean }Mark the activity as started. Triggers the attempted xAPI event the
first time it's called for an instance.
Helper function to create xAPI completed events.
Use triggerXAPIScored instead
Helper function to create scored xAPI events
Will be set as the 'raw' value of the score object
Will be set as the "max" value of the score object
Short form of adl verb
Is this a statement from a completed activity?
Is this a statement from an activity that was done successfully?
Any class that implements this interface can be used as a widget in H5P. It defines the methods that are required for a widget to work:
appendTo,validateandremove.appendTois called when the widget is added to the DOM. It provides the container element as a jQuery object. It is crucial to add the widget to the container element.validateis called in certain cases by the H5P framework to check if the widget is valid, for instance when the user collapses the dropdown that the widget belongs in. If the widget is not valid, the dropdown will not collapse.removeis called when the widget is removed from the DOM. Here you should remove any global event listeners that you have added to avoid memory leaks.It is recommended to use the
H5PWidgetclass fromh5p-utilsas a base class for your widget. It sets up the widget and adds the constructor parameters as properties on the class. It also extends theH5P.EventDispatcherclass, which allows you to use thetriggerandonmethods to trigger and listen to events.⚠️ If you decide not to extend the
H5PWidgetclass, you will have to extendH5P.EventDispatcheryourself.Example