Skip to content

fix(zone.js): correctly patch es6 classes #15

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

Merged
merged 1 commit into from
Jul 21, 2021
Merged

Conversation

edusperoni
Copy link
Collaborator

PR Checklist

What is the current behavior?

Zone uses a for(prop in object) to patch all class properties, but this doesn't work with es6 as class properties aren't enumerable. Since NativeScript is distributed in es6+ the FileReader polyfill doesn't get properly patched by zonejs

What is the new behavior?

Use Object.getOwnPropertyNames instead, so FileReader is patched correctly.

Currently only MutationObserver, WebKitMutationObserver, IntersectionObserver, FileReader and legacy XMLHttpRequest are patched this way. Of all of them, only FileReader is polyfilled by NativeScript (the legacy XMLHttpRequest patch is already disabled)

Fixes #14.

@NathanWalker NathanWalker merged commit 2dca0ce into main Jul 21, 2021
@NathanWalker NathanWalker deleted the fix/filereader branch July 21, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Response.json() throwing TypeError: reader.readAsText is not a function after nativescript-angular 12
2 participants