Description
my.offComponentError
Remove the error
event listener function of the JS code inside the mini program custom component.
Input parameter
Function listener
The callback function for the JS code inside the custom component reports an error when running.
Parameter
Property | Node type | Description |
error | Error | The exception object. |
method | String | The custom component method where the exception occurred. |
component | Component | The custom component instance where the exception occurred. |
Sample code
my.offComponentError(Function listener)
Page({
onLoad() {
my.onComponentError(this.errorHandler);
},
errorHandler(error, method, component) {
console.log('onComponentError res', error);
console.log('onComponentError stack', method);
console.log('onComponentError component', component);
},
// Stop listening to the events.
offComponentError() {
my.offComponentError(this.errorHandler)
}
})