Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: onUnhandledRejection 支持core-js promise polyfill #1822

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

kimi233
Copy link
Collaborator

@kimi233 kimi233 commented Jan 17, 2025

No description provided.

global.onunhandledrejection = function onunhandledrejection (event) {
// event = { promise, reason }
rejectionTrackingOptions.onUnhandled(null, event.reason)
oldOnUnhandledRejection.apply(this, event)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这应该是call吧

const oldOnUnhandledRejection = global.onunhandledrejection
global.onunhandledrejection = function onunhandledrejection (event) {
// event = { promise, reason }
rejectionTrackingOptions.onUnhandled(null, event.reason)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把promise作为三个参数传过去,然后onUnhandled中做一下兼容处理

@hiyuki hiyuki merged commit 62b48fe into master Jan 17, 2025
6 checks passed
@hiyuki hiyuki deleted the feat-polyfill-UnhandledRejection branch January 17, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants