From 210b0282b244166151d90304b0832f4761c49af7 Mon Sep 17 00:00:00 2001 From: anotherso1a <1181581742@qq.com> Date: Wed, 6 Mar 2024 15:06:32 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=92=8C=E8=B5=8B=E5=80=BC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/api-proxy/src/common/js/promisify.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api-proxy/src/common/js/promisify.js b/packages/api-proxy/src/common/js/promisify.js index 79da09887c..40a1a83188 100644 --- a/packages/api-proxy/src/common/js/promisify.js +++ b/packages/api-proxy/src/common/js/promisify.js @@ -68,11 +68,11 @@ function promisify (listObj, whiteList, customBlackList) { } result[key] = function (...args) { + const obj = args[0] || {} // 不需要转换 or 用户已定义回调,则不处理 - if (!promisifyFilter(key) || ['success', 'fail', 'complete'].some(k => args[0] && args[0][k])) { + if (!promisifyFilter(key) || obj.success || obj.fail) { return listObj[key].apply(envObj, args) } else { // 其他情况进行转换 - const obj = args[0] || { success: noop, fail: noop } if (!args[0]) args.unshift(obj) let returned const promise = new Promise((resolve, reject) => {