Initial commit
This commit is contained in:
11
uni.promisify.adaptor.js
Normal file
11
uni.promisify.adaptor.js
Normal file
@@ -0,0 +1,11 @@
|
||||
uni.addInterceptor({
|
||||
returnValue(res) {
|
||||
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then ===
|
||||
"function")) {
|
||||
return res;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user