Skip to content

Commit

Permalink
feat: onUnhandledRejection 支持core-js promise polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
mackwang committed Jan 17, 2025
1 parent 31280e7 commit dc25d11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/platform/env/index.ios.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dc25d11

Please sign in to comment.