From dc25d111ae0b0a2cb19441f05a982eb76dcf1ae0 Mon Sep 17 00:00:00 2001 From: mackwang Date: Fri, 17 Jan 2025 17:47:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20onUnhandledRejection=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81core-js=20promise=20polyfill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/platform/env/index.ios.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/platform/env/index.ios.js b/packages/core/src/platform/env/index.ios.js index af2b1c628..7ff89d538 100644 --- a/packages/core/src/platform/env/index.ios.js +++ b/packages/core/src/platform/env/index.ios.js @@ -1,4 +1,4 @@ -import { isNumber, isString } from '@mpxjs/utils' +import { isFunction, isNumber } from '@mpxjs/utils' import { createI18n } from '../builtInMixins/i18nMixin' export function init (Mpx) { @@ -51,9 +51,9 @@ function initGlobalErrorHandling () { const oldOnUnhandledRejection = global.onunhandledrejection global.onunhandledrejection = function onunhandledrejection (event) { onUnhandledRejection(event) - oldOnUnhandledRejection.call(this, event) + isFunction(oldOnUnhandledRejection) && oldOnUnhandledRejection.call(this, event) } - if (global?.HermesInternal?.hasPromise?.()) { + if (global.HermesInternal?.hasPromise?.()) { global.HermesInternal.enablePromiseRejectionTracker?.(rejectionTrackingOptions) } else { require('promise/setimmediate/rejection-tracking').enable(rejectionTrackingOptions)