Chapter 12. Host Event Manager

The Host Event Manager supports the application level event system by wrapping communication from the Engine and re-broadcasting events to individual apps.

KONtx.HostEventManager

Toolbox event utility

The KONtx.HostEventManager class manages event communication between the KONtx Framework and the Engine. Events from the Engine are received by the KONtx.application class and re-fired as KONtx.system.Event types. You can subscribe to events coming from the Engine through the subscribeTo(KONtx.application) method and send events to the Engine through the KONtx.HostEventManager.send() method.

Subscribe to these KONtx.HostEventManger events from the Engine

The following table defines the "subscribeable" Host events you can subscribe to through the KONtx.HostEventManager. Note that some of these events are captured by the KONtx.application manager and may or may not be retriggered.

Handler Name

Event Class

Received By

Description

getSnippetConfs

HostEvent

app

Gathers bookmark metadata.

onActivateAppButton

HostEvent

app

A button owned by the Engine in the sidebar has been activated.

onActivateSnippet

HostEvent

app

The user launches a bookmark.

onAppInit

HostEvent

app

The app’s main file is loaded.

onAppFin

HostEvent

app

The app is closing down.

onDialogCancelled

HostEvent

app

Dialog has been cancelled.

onDialogDone

HostEvent

app

Dialog has been completed.

onHideView

HostEvent

app

The app view is no longer visible.

onLoadProfile

HostEvent

app

The app is newly initialized or switching profiles.

onLoadView

HostEvent

app

The Engine has loaded the app’s XML.

onPlaybackAction

HostEvent

app

The Engine had detected PLAY, PAUSE, STOP, REWIND, or FORWARD keypress. The KONtx.application manager captures the onPlaybackAction Host event, sets the KONtx.videoplayer.prototype.keys key code and fires the onPlayControlKeyPress Framework event. Available in KONtx 1.2 and above.

onShowView

HostEvent

app

The app view is preparing to be made visible.

onUnloadProfile

HostEvent

app

The app is switching profiles.

onUnloadView

HostEvent

app

The app view is unloaded.

onDispatchedChildEvent

HostEvent

app

A Child Event has been dispatched to the Engine.

onSelect

HostEvent

button, view

The button or view has been selected.

onUnselect

HostEvent

view

The view has lost focus.

Dispatch these KONtx.HostEventManager events to the Engine

The following table defines the "fireable" Host events you can trigger through the KONtx.HostEventManager and send to the Engine.

Handler Name

Event Class

Received By

Description

addAppDownloadSnippetConf

ChildEvent

Engine

Identifies apps to be downloaded.

addSnippetConfs

ChildEvent

Engine

Updates and appends bookmarks.

appDownloaded

ChildEvent

Engine

Successful download.

appDownloadFailed

ChildEvent

Engine

Download failure.

changeProfile

ChildEvent

Engine

Requests profile change.

deleteSnippetConfs

ChildEvent

Engine

Delete bookmarks.

exitToDock

ChildEvent

Engine

The screensaver or dialog exits to the dock.

exitToFullscreenVideo

ChildEvent

Engine

The screensaver or dialog exits to fullscreen video.

getScreensaverTimeout

ChildEvent

Engine

Returns the screensaver-timeout value.

getScreensaverTimeoutList

ChildEvent

Engine

Returns an array of integers for possible values for the screensaver timeout.

guidedSetup

ChildEvent

Engine

Restarts the out-of-the-box guided setup experience. Requires super/privileged credentials. Available in KONtx Framework 1.2 and above.

hideDialog

ChildEvent

Engine

Hides the dialog box.

loadView

ChildEvent

Engine

Requests the loading of a view.

restart

ChildEvent

Engine

Restarts the dock. Requires super/privileged credentials. Available in KONtx Framework 1.2 and above.

setExitVideoDialog

ChildEvent

Engine

Event sent to the Engine to determine whether to display an "Are you sure?" exit dialog when the user presses the Yahoo TV Key in fullscreen mode while video is playing. The possible values are JSON strings of true or false. For those builds where the configuration parameter allow-video is set to global (Vizio, LG, and the generic WDK), the default is not to display the dialog. In those builds where allow-video is set to fullscreen-only (Samsung), the dialog is always displayed, and this event is ignored. Available in KONtx Framework 1.2 and above.

setFavAction

ChildEvent

Engine

Controls the add/delete bookmark function in the global navigation bar.

setFullscreenVideoMode

ChildEvent

Engine

Event sent to the Engine to enable passthrough video to be displayed in fullscreen mode. The KONtx.application manager detects a view that must be a KONtx.system.FullscreenView with the showPassthroughVideo configuration property set to true. This event takes one string parameter: default or passthrough. For the default mode, entering fullscreen mode stops streaming videos from other apps and stops passthrough video. The volume, numeric, and playback keys are passed to the app. For the passthrough mode, entering fullscreen mode stops all streaming videos and passthrough video is turned on. The volume, numeric, and playback keys are not passed to the app. In the passthrough mode, the app cannot start streaming videos. Available in KONtx Framework 1.2 and above.

setIcons

ChildEvent

Engine

Sets the network status icons in the sidebar.

setScreensaver

ChildEvent

Engine

Enables the screensaver in fullscreen mode.

setScreensaverTimeout

ChildEvent

Engine

Overrides the screensaver-timeout config value in config.xml.

setSettings

ChildEvent

Engine

Event sent to the Engine to indicate the existence of the app’s settings page. Available in KONtx Framework 1.2 and above.

setSnippetConfs

ChildEvent

Engine

Sets or resets bookmark metadata.

setWaitIndicator

ChildEvent

Engine

Sets the “please wait” animation.

showDialog

ChildEvent

Engine

Shows a dialog box.

Example

Example

Example

Methods

void Function.prototype.subscribeTo(Object publishingObject, StringOrArray eventTypes, Object bindingScope);

Subcribes to the event type String or Array of events defined by the parameter eventTypes that are owned by the parameter publishingObject, in this case KONtx.HostEventManager. The optional parameter bindingScope is used to bind this function to the given scope before subscribing. This method extends the Function.prototype and is used to listen to events from any event publishing Object.

void printLog(Boolean parseable);

Prints the event log. The parameter parseable, if true, indicates that descriptive text is not printed.

void send(String eventType, Object data);

Creates a new HostEvent and sends it to the Engine. The parameter eventType is the String identifier of the event. The Object data parameter is the parameter data that should be sent to the Engine with the event. Checks to make sure that the given event is in the list of “fireable” host events, and calls widget.dispatchChildEvent() with the new HostEvent and its data.

Table of Contents