my.offUnhandledRejection

更新时间:
复制 MD 格式

Removes a listener function for unhandled Promise rejection events.

Description

my.offUnhandledRejection

Removes a listener function for unhandled Promise rejection events.

Input parameter

Function listener

The callback function for unhandled Promise rejection events.

Sample code

my.offUnhandledRejection(Function listener)

Page({
 onLoad() {
 my.onUnhandledRejection(this.unhandledRejectionHandler);
 },
 unhandledRejectionHandler(res) {
 console.log('onUnhandledRejection reason', res.reason);
 console.log('onUnhandledRejection promise', res.promise);
 },
 offUnhandledRejection() {
 my.offUnhandledRejection(this.unhandledRejectionHandler);
 }
})