文档

my.offUnhandledRejection

简介

my.offUnhandledRejection

移除未处理的 Promise 拒绝事件的监听函数。

入参

Function listener

未处理的 Promise 拒绝事件的回调函数。

代码示例

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);
 }
})
  • 本页导读 (0)
文档反馈