开发者社区
社区提问意见反馈
开发者钉组织
扫描二维码
加入支付宝开发者钉组织
基础 api
基础
应用级事件
界面
跳转
多媒体
缓存
文件
位置
网络
设备
worker
数据安全
分享
收藏
自定义通用菜单
更新管理
web-view组件控制
升级支付宝最新版本
隐私信息授权
小程序广告
开放能力 api
开发 > api > 基础 api >  > my.offunhandledrejection
评论
收藏
我的文档
设置

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);
  }
})
内容没有解决您的问题?您还可以前往 或 寻求帮助
凯发k8官方网娱乐官方 copyright © 2022 支付宝(杭州)信息技术有限公司  | icp证浙b2-20160559
该文档对你是否有帮助?
当前页面目录
网站地图