removeAppListener( ApplicationListener, [containingObject] ) method

Remove the application listener.

This function should be called with identical parameters that were used to add the application listener with hwc.addAppListener.

Syntax

<static> removeAppListener( ApplicationListener, [containingObject] )

Parameters

Name Type Argument Description
ApplicationListener anonymous.AppListener   The callback for application changes.
containingObject Object (optional) The containing object of the application listener function.

Example

// This is the callback function that will be passed to hwc.addAppListener.
var appListener = function( event, moduleId, version )
{
   if( event == hwc.APP_ADDED )
   {
      alert("A hybrid app has been added.");
   }
}
hwc.addAppListener( appListener );
// At some other point, if we want to remove the listener we use the following line of code:
hwc.removeAppListener( appListener );
// appListenerManager is an object that will contain the callback function as well as variables
// the callback function references.
var appListenerManager = {};
// doSomething is a function that is called from inside the callback function.
appListenerManager.doSomething = function( event )
{
   if( event == hwc.APP_REMOVED )
   {
      alert("A hybrid app has been removed.");
   }
}
// This is the callback function that will be passed to hwc.addAppListener.  It calls doSomething,
// the definition of which is in the containing function.
appListenerManager.listener = function( event, moduleId, version )
{
   this.doSomething( event );
}
// Since the listener callback function references a variable from its containing object,
// the containing object must be passed to hwc.addAppListener.
hwc.addAppListener( appListenerManager.listener, appListenerManager );
// At some other point, if we want to remove the listener we use the following line of code:
hwc.removeAppListener( appListenerManager.listener, appListenerManager );

Source

hwc-api.js, line 1602.