Module: standardPlayer/PageEventContext

This context provides methods to handle events in the page scope.

To handle the differences between standard and HTML5 player, it is recommended
to take note of the following example.

Example

onCallback: function (dataTHML5, dataHTML4) {
    var data = dataHTML4 || dataTHML5;
    […]
}

Methods

<inner> bind(component, eventName)

Binds a component method to a custom event.

Preconditions:


  • The stated component must provide a method according to custom event.

  • On callback the method receives the following arguments:

    • {object} The event object

    • {object} The id of the sender

    • {object} Custom data



Callback time point:


  • When a fireCustomMessage is fired.

Parameters:
Name Type Description
component Component

The component that provides the specified callback method.

eventName function

The custom event name.

<inner> bindOnEnter(component)

Binds a component method to the onEnterPage event that is sent by the TTKF Player.

Preconditions:


  • The stated component must provide an "onEnterPage" method.

  • The stated component can provide an "onAllComponentsReady" method.

Callback time point:


  • The "onEnterPage" method is called when the page is displayed on the wbt stage.

  • The "onAllComponentsReady" is called after the "onEnterPage" method is handled by all components on the wbt stage.

Parameters:
Name Type Description
component Component

The component that provides the specified callback method.

<inner> bindOnExit(component)

Binds a component method to the onExitPage event that is sent by the TTKF Player.

Preconditions:


  • The stated component must provide an "onExitPage" method.

Callback time point:


  • The page is displayed on the wbt stage.

Parameters:
Name Type Description
component Component

The component that provides the specified callback method.

<inner> fire(component, eventName, data)

Fires a custom event that you can use within the SmartComponents.

The event will dispatch all custom event methods with the same event name.

Parameters:
Name Type Description
component Component

The component that fires the event.

eventName function

The custom event name.

data object

Custom data the will be send with the event

<inner> trigger(component, eventName)

Dispatches a component event addressing the TTKF trigger functionality.

All TTKF triggers that listen to this specific event will be executed.
The triggers you are using have to be defined within the component's metadata file.

Parameters:
Name Type Description
component Component

The component that triggers the event.

eventName function

The event name.