From 153404ffa0a9c6d23d2c2732b46fa6929e86294f Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 18 六月 2025 13:56:18 +0800
Subject: [PATCH] 111
---
h5/uni.promisify.adaptor.js | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/h5/uni.promisify.adaptor.js b/h5/uni.promisify.adaptor.js
new file mode 100644
index 0000000..5fec4f3
--- /dev/null
+++ b/h5/uni.promisify.adaptor.js
@@ -0,0 +1,13 @@
+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) => {
+ if (!res) return resolve(res)
+ return res[0] ? reject(res[0]) : resolve(res[1])
+ });
+ });
+ },
+});
\ No newline at end of file
--
Gitblit v1.9.3