Remove the log listener.
This function should be called with identical parameters that were used when adding the log listener with hwc.addLogListener.
<static> removeLogListener( LogListener, [containingObject] )
Name | Type | Argument | Description |
LogListener | anonymous.LogListener | The callback function for log events. | |
containingObject | Object | (optional) | Object containing definition of ConnectionStateListener |
// A global function called by the log listener. var doSomething = function() { alert("this gets displays when there is a log event."); } // The log listener callback function that will be passed to hwc.addLogListener. // This function will be invoked whenever there is a log event. var logListener = function( event, errorCode, errorMessage ) { doSomething(); } // Add the log listener. hwc.addLogListener( logListener ); // at some other point if we want to remove the listener, we use the following line hwc.removeLogListener( logListener );
// logListenerManager is an object that will contain the listener callback as well // as a function that will be invoked from the listener callback function. var logListenerManager = {}; // This is a function that is called from the listener callback. logListenerManager.doSomething = function() { alert("this gets displays when there is a log event."); } // This is the listener callback that will be passed to hwc.addLogListener. // Since a variable is referenced from the containing object, the containing object // will need to be passed to hwc.addLogListener. logListenerManager.listener = function( event, errorCode, errorMessage ) { this.doSomething(); } // Pass both the listener callback and the containing object. hwc.addLogListener( logListenerManager.listener, logListenerManager ); // at some other point if we want to remove the listener, we use the following line hwc.removeLogListener( logListenerManager.listener, logListenerManager );