IBM Worklight v5.0.5 > API reference > IBM Worklight client-side API > JavaScript client-side API

WL.App.BackgroundHandler.setOnAppEnteringBackground


Define the behavior of the application before it enters the background.

Applies for iOS 4 and above.

Defines the behavior of the application just before iOS takes a screen capture of it before moving it to the background.

Parameter Description
handler Function called upon receiving the event from iOS that the application is about to enter background. Values:

WL.App.BackgroundHandler.defaultIOSBehavior

Use the default behavior of iOS (which is equivalent to not doing anything).

WL.App.BackgroundHandler.hideView

Display a black screen instead of the browser component.

WL.App.BackgroundHandler.showSplashScreen

Show a splash screen instead of the application

WL.App.BackgroundHandler.hideElements

Hide all HTML elements that have the style WLHideOnEnteringBackground

Custom function


Examples

Example: Use hideElements

// CSS
<span id=”moneyInTheBank” class=”WLHideOnEnteringBackground”> … </span>
// JavaScript
WL.App.BackgroundHandler.setOnAppEnteringBackground(
WL.App.BackgroundHandler.hideElements);

Example: Use custom function

// JavaScript
WL.App.BackgroundHandler.setOnAppEnteringBackground(myFunc);


Parent JavaScript client-side API