my.offError

Unlisten for the event that JS errors occur in the mini program.

Sample code

copy
// .js
App({
  onShow() {
    this.handleError = error => {
      // Errors occur when running the mini program.
      console.log(error);
    }
    // The type of error is String.
    my.onError(this.handleError);
  },
  onHide() {
    // Unlisten for the event that JS errors occur in the mini program.
    my.offError(this.handleError);
  }
})

Parameters

Property

TypeDescription

callback

Function

The callback function for the event that JS errors occur in the mini program.