平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uni.promisify.adaptor.js 309 B

2 maanden geleden
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. });