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 the custom event.
- On callback the method receives the following arguments:
- {Object} The id of the sender
- {Object} Custom data
Callback time point:
- When a fireCustomMessage is fired.
Parameters:
Name Type Description component
Object 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 "onPreparePage" 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> bindOnTransform(component)
-
Binds a component method to the onEnterPage event that is sent by the TTKF Player.
Preconditions:
- The stated component must provide an "onTransformPageStart" method.
- The stated component can provide an "onTransformPageReset" method.
Callback time point:
- The "onTransformPageStart" method is called when the page is started to transform.
- The "onTransformPageReset" is called when the transforming is forced to reset.
Parameters:
Name Type Description component
Object 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
Object 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 that is addressing a TTKF trigger functionality.
The trigger you want to use must be defined in the component metadata file.
All TTKF trigger that listen on this page are executed.Parameters:
Name Type Description component
Object The component that triggers the event.
eventName
function The event (trigger) name.