Default component overview
When we integrate Worklight and HCL WebSphere Portal, we can create a Worklight hybrid application that includes a HCL WebSphere Portal web application. This hybrid application can run in a mobile browser and as a native mobile application.
Modules
The wp_worklight_ext module is included in the default deferred profile and is active by default. This module automatically loads the Worklight Client and Cordova APIs, so we can add native device capabilities in the hybrid applications. The APIs are JavaScript resources and are optimized for each device. For example, the iOS resources are loaded in a Worklight hybrid application on an iOS device, but not in other circumstances such as in a web application, on an android device, or on a desktop.
Device classes
- worklight
- ios
- android
- blackberry
- smartphone
- tablet
With these device classes, we can target the appropriate environment to expose the native capabilities within HCL WebSphere Portal. The default Worklight modules use these devices classes to determine which resources to load. If we are adding to the default capabilities, we can also use these device classes to optimally load our own device-specific resources.
Device class equations
- android+smartphone
- worklight+(ios/android)
- (android/ios)+worklight+!tablet
With device class equations, we can create a specific device class that includes or excludes some of the device classes. Use parenthesis to group the device classes. To use the operation AND, use the plus sign, +. To use the operation OR use the forward slash, /. To use the operation NOT, use the exclamation point, !.
APIs & Samples
- Worklight Client
- WL.Client.getUserInfo
- WL.Client.Push.subscribe
- And others
- Cordova
- Authentication
- WL.Client.createChallengeHandler
- And others
The new Worklight resources allow access to native device capabilities using the high-level JavaScript without having to know or use the native device programming language. The JavaScript APIs call the native device APIs for you. Sample apps are provided on the catalog for each of the APIs to show example usage syntax. We can copy, paste, and modify these samples to fit the needs.
To get started, create a Worklight hybrid application that points to and renders the HCL WebSphere Portal URL. Modify the HCL WebSphere Portal code to call the JavaScript APIs to access the native device capabilities. For example, the application could have a feature for taking and uploading a picture available on devices that have cameras and unavailable otherwise. Or a feature that is tailored to the user's geolocation on devices that have GPS and not otherwise. Or a feature that sends and receives push notifications on devices that support push notifications and not otherwise.
Parent Integrate with IBM Worklight
Related information
Apache Cordova
Worklight API