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


Initialize the WL.Client object. Called by the initOptions.js file.

An optional options object augmented with the following additional optional properties:

Property Description
Timeout Integer value, denoting the timeout in milliseconds. Affects all calls from the app to the WL server. If not specified, a timeout of 30,000 milliseconds (30 seconds) is used.
showLogger true or false. Indicates whether the Worklight logger window is displayed. If the value is null or unspecified, the logger window is not displayed. For development purposes only. Log lines can be added to the logger using the WL.Logger object.
messages A dictionary object for localizing texts, located in the messages.js file. If not specified, the default object Messages (in the same file) is used.
authenticator An object that implements the Authenticator API. If not specified, Authenticator is used.
heartBeatIntervalInSecs An integer value, denoting the interval in seconds between heartbeat messages automatically sent by WLClient to the WL server. The default value is 1200 (20 minutes).
minAppWidth Minimum width for the application in pixels. If the application is contracted to less than this width, Worklight automatically displays a message, which asks the user to expand the application. The default value is 170. Relevant only for iGoogle.
connectOnStartup Whether to connect to the WL server. The default if no value is specified is true. However, the default value set in the initOptions.js file is false, which is appropriate if the app does not retrieve any corporate data on startup. Server features such as Remote Disable or Direct Update are only available after the app connects to the server. The value true is appropriate if the app must receive data from the server when it starts. However, the app might start more slowly.
onConnectionFailure A failure handling function invoked when connection to the WL server, performed on initialization by default, or if the connectOnStartup flag is true, fails.
onUnsupportedVersion A failure handling function invoked when the current version of the application is no longer supported (a newer application has been deployed to the server).
onRequestTimeout A failure handling function invoked when the init() request times out.
onUnsupportedBrowser A failure handling function invoked when the application is running in an unsupported browser.
onDisabledCookies A failure handling function invoked when cookies are displayed in the user's browser. For more information about the signature of failure handling functions,
onUserInstanceAccessViolation A failure handling function invoked when the user is trying to access an application that was provisioned to a different user.
onErrorAppVersionAccessDenial A failure handling function invoked when the server denies access to the application, according to rules defined in the Worklight Console. After invoking this function, the app exits. If the failure handling function is not provided, the application opens a dialog box, which displays an error message defined in the Worklight Console. It then requires the user to close the application.
validateArguments A Boolean value, indicating whether the Worklight Client runtime library validates the number and type of method parameters. The default is true.
updateSilently A Boolean value, indicating whether Direct Update is performed without notifying the user before downloading new application resources. Default is false.
onGetCustomDeviceProvisioningProperties A callback function invoked during the provisioning process of the device ID created by the app on the device. Typical implementation collects an out-of-band provisioning token from the user.

The function receives a function argument resumeDeviceProvisioningProcess, which must be called to resume the provisioning process, and transfers the custom provisioning data as a JSON hash map.

<body id="content" 
      onload="WL.Client.init({onGetCustomDeviceProvisioningProperties: collectCustomProvisioningProperties})" 
      style="display: none">
function collectCustomProvisioningProperties (resumeDeviceProvisioningProcess)
    // Collect provisioning token from user 
    resumeDeviceProvisioningProcess( {token: token});

The onSuccess function is used to initialize the application.

If an onFailure function is not passed, a default onFailure function is called. If onFailure is passed, it overrides any specific failure-handling function.

Return Value


Parent JavaScript client-side API