HP Anywhere 10.11 API Reference
Show:

HPA.Events

Module: HPA

Available since HP Anywhere 10.10

Enables the app to listen to the following HP Anywhere events:


backbutton

Fired every time an end user taps the Android device's Back button.

HP Anywhere 10.10 applies to [Android Smartphone]

HP Anywhere 10.11 applies to and [Android Smartphone and Tablet].
As of version 10.11, if the callback function returns the value "true", HP Anywhere navigates to the page from which the user opened your app (such as My Apps or a different app). This is the required behavior if the first page of your app is currently displayed.

if (!window.myApp) { 
    //To help ensure that the back button works for all entry points 
    // defined in a section of code, register once for each instance early 
    // in the code, for example, in setReady.
    HPA.Events.on("backbutton", function (eventData) {
        if (LetHPADecide) {
            return true;
        } else {
            return window.myApp.goBack(); //define the navigation yourself
        }
    });
}

offline

Fired every time the container switches between online and offline.

HPA.Events.on("offline", offlineHandler );

offlineHandler = function( eventData ){
    if (eventData.isOnline){
        alert("my app is online ");
    }
}

focus

Fired whenever an application gets or loses focus.

HPA.Events.on("focus", focusHandler );

focusHandler = function( eventData ){
    //eventData contains the  following data:
    {
        'inFocus': item.id,
        'lostFocus': oldItem && oldItem.id
    }
 }

Methods

Methods

off

(
  • eventName
)

Removes the event handler listener from the app.

Parameters:

  • eventName String

    event's name

on

(
  • eventName
  • listener
)

Appends an event handler listener to the app.

Parameters: