1
0

uni.promisify.adaptor.js 309 B

12345678910
  1. uni.addInterceptor({
  2. returnValue (res) {
  3. if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
  4. return res;
  5. }
  6. return new Promise((resolve, reject) => {
  7. res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
  8. });
  9. },
  10. });