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

Add polyfills for new methods of Promise (ES2020+) #491

Closed
retyui opened this issue Jul 13, 2022 · 2 comments
Closed

Add polyfills for new methods of Promise (ES2020+) #491

retyui opened this issue Jul 13, 2022 · 2 comments

Comments

@retyui
Copy link

retyui commented Jul 13, 2022

Introduction

Add polyfills for:

  • Promise.allSettled
  • Promise.any

Details

Latest Hermes engine already implement es2020, es2021 methods, react-native-v8 also, JCS too:

Promise.allSettled() // es2020, TypeError: undefined is not a function
str.matchAll(/regex/g) // es2020
Symbol.matchAll // es2020
String.prototype.replaceAll // es2021
Promise.any() // es2020, TypeError: undefined is not a function

but React Native use then/promise module to polyfill Promise and new methods of Promise not available

never mind what engine and how fresh is it (react-native-v8, JSC (iOS 15+), hermes-engine),
new Promise methods will be always undefined (RN uses a 2 years old then/promise module)

See tabel: https://retyui.github.io/react-native-compat-table/

Discussion points

  1. Is it still required at 2022 to use then/promise
  2. How then we can polyfill new methods? (I tried to contribute to that repo Implement Promise.allSettled() then/promise#171 but seems it won't be merged in nearest future)
@jahglow
Copy link

jahglow commented Jul 26, 2022

Thumbs up for it, because I also stumble upon these inconsistencies and they are pain! Serious topic that's been ignored for a year, that's weird!

@retyui
Copy link
Author

retyui commented Sep 6, 2022

@retyui retyui closed this as completed Sep 6, 2022
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

No branches or pull requests

2 participants