Removes a log listener.
This function should be called with identical parameters that were used when adding the log listener with AppLog.startLogListener.
<static> stopLogListener( successCB, errorCB, logListener, [containingObject] )
Name | Type | Argument | Description |
successCB | anonymous.startOrStopLogListenerSuccessCallback | A callback function that will be invoked if the log listener is successfully removed. | |
errorCB | anonymous.startOrStopLogListenerErrorCallback | A callback function that will be invoked if there is an error removing the log listener. | |
logListener | anonymous.logListener | The callback that was added with AppLog.startLogListener. | |
containingObject | Object | (optional) | Object containing the definition for logListener. |
// This example shows how to use this function with a globally-scoped logListener. // A global function called by the log listener. var doSomething = function() { alert("this gets displayed when there is a new log entry."); } // The log listener callback function that will be passed to AppLog.startLogListener. // This function will be invoked whenever there is a new log entry. var logListener = function( date, statusCode, message ) { doSomething(); } function onStartLogListenerSuccessCallback() { // Do something here after listener has been added } function onStartLogListenerFailureCallback(error) { // React to error here } function onStopLogListenerSuccessCallback() { // Do something here after listener has been removed } function onStopLogListenerFailureCallback(error) { // React to error here } // Add the log listener. AppLog.startLogListener( onStartLogListenerSuccessCallback, onStartLogListenerFailureCallback, logListener ); // At some other point if we want to remove the listener, we use the following line. AppLog.stopLogListener( onStopLogListenerSuccessCallback, onStopLogListenerFailureCallback, logListener );
// This example shows how to use this function with a logListener contained in an object. // 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 displayed when there is a new log entry."); } // This is the listener callback that will be passed to AppLog.startLogListener. // Since a variable is referenced from the containing object, the containing object // will need to be passed to AppLog.startLogListener. logListenerManager.listener = function( date, statusCode, message ) { this.doSomething(); } function onStartLogListenerSuccessCallback() { // Do something here after listener has been added } function onStartLogListenerFailureCallback(error) { // React to error here } function onStopLogListenerSuccessCallback() { // Do something here after listener has been removed } function onStopLogListenerFailureCallback(error) { // React to error here } // Pass both the listener callback and the containing object. AppLog.startLogListener( onStartLogListenerSuccessCallback, onStartLogListenerFailureCallback, logListenerManager.listener, logListenerManager ); // At some other point if we want to remove the listener, we use the following line. AppLog.stopLogListener( onStopLogListenerSuccessCallback, onStopLogListenerFailureCallback, logListenerManager.listener, logListenerManager );