promise封装微信request方法
理论
异步 API 返回 Promise:Promise其实是一个构造函数,它有resolve,reject,race等静态方法;它的原型(prototype)上有then,catch方法,因此只要作为Promise的实例,都可以共享并调用Promise.prototype上面的方法(then,catch)。
promise语法:new Promise(function(resolve,reject){}/*excutor*/);,在实例化Promise时需要传入一个函数excutor(函数)作为参数
原创
2022-05-11 09:31:37 ·
278 阅读 ·
0 评论