my.offunhandledrejection(function listener)
基础库 或更高版本; 且 支付宝客户端 10.1.75 或更高版本; 若版本较低,建议采取 兼容处理 。
主体: 企业支付宝小程序 、 个人支付宝小程序
移除未处理的 promise 拒绝事件的监听函数。
function listener
onunhandledrejection 传入的监听函数
查看示例
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);
}
})