webOS Events
webOS events allow web apps to register different event handlers on specific cases. Events are normally used in combination with functions, and the function will not be executed before the event occurs.
Event | Description |
---|---|
webOSLaunch | This event is fired when an app is launched. |
webOSRelaunch | This event is fired before an app's status is switched from the background state to the foreground state. |
webOSLocaleChange | This event is fired when the language is changed in the Settings. |
webOSMouse | This event is fired depending on whether LG Magic Remote's pointer cursor is focused on an app. |
keyboardStateChange | This event is fired when the visibility status of the virtual keyboard is changed. |
cursorStateChange | This event is fired when the visibility status of LG Magic Remote's pointer cursor is changed. |
webOSLaunch
Description
This event is fired when an app is launched. When the DOMContentLoaded event, which is triggered right after the HTML document loading of a running app, is completed, this event is delivered to the app.Example
document.addEventListener('webOSLaunch', function()
{
// Do something
}
)
See also
App Lifecycle Management webOSRelaunch
Description
This event is fired before an app's status is switched from the background state to the foreground state.Example
document.addEventListener('webOSRelaunch', function()
{
// Do something
}
)
See also
App LifecyclewebOSLocaleChange
Description
This event is fired when the language is changed in the Settings.Example
document.addEventListener('webOSLocaleChange', function(){' '}
{
// Do something like reloading redirection url
}
)
webOSMouse
Description
This event is fired depending on whether LG Magic Remote's pointer cursor is focused on an app. This event is similar to the mouseenter event and the mouseleave event of HTML5.Example
document.addEventListener('webOSMouse', function(event) {
var mouse = event.detail.type;
if (mouse === 'Enter') {
// Do something
} else if ( mouse === 'Leave') {
// Do something
}
})
Properties
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail | Object | The object that has event information
|
keyboardStateChange
Description
This event is fired when the visibility status of the virtual keyboard is changed. The visibility status is changed depending on whether the virtual keyboard is activated or deactivated. The virtual keyboard is usually activated when input elements are focused.Example
document.addEventListener('keyboardStateChange', function(event) {
if (event.detail && event.detail.visibility) {
// Do something
} else {
// Do something
}
})
Properties
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail | Object | The object that has event information
|
See also
System UI VisibilitycursorStateChange
Description
This event is fired when the visibility status of LG Magic Remote's pointer cursor is changed.Example
document.addEventListener('cursorStateChange', function(event) {
if (event.detail && event.detail.visibility) {
// Do something
} else {
// Do something
}
})
Properties
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail | Object | The object that has event information
|
See also
System UI VisibilityNo Headings