-
Notifications
You must be signed in to change notification settings - Fork 27k
refactor(zone.js): remove onProp eventName array to reduce bundle size #40962
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
Conversation
josephperrott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like we just need the size tracking to be updated.
76e8a7f to
41bfd50
Compare
AndrewKushnir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great refactoring and almost 4Kb savings! 👍
Reviewed-for: size-tracking
|
@JiaLiPassion it looks like there are more places where payload size should be updated, see Could you please also set the "target" label (would it be safe to land in patch version or only in major)? |
a93240f to
f88f609
Compare
|
@AndrewKushnir , @josephperrott , thank you for the review. I have updated the size and also added the target label. |
|
@JiaLiPassion sure, I've started a presubmit, will let you know how it goes. |
|
@JiaLiPassion FYI presubmits went well, but I think we'd need to run a global one before merging this change. Thank you. |
|
@AndrewKushnir , got it, thank you! |
petebacondarwin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: size-tracking
f3eb998 to
939c525
Compare
|
@AndrewKushnir, got it, thank you very much! |
581ed79 to
17d40b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a doc comment to this function describing its intention (and specifically, that it only considers the immediate object properties and not any inherited properties).
17d40b6 to
abbc31e
Compare
|
@alxhub , thank you for the review, I have added the comments and update the code style. |
98bd50a to
044b343
Compare
…e size Zone.js supports the google closure compiler in the advance optimization mode, to prevent closure compiler modify the `onProperty` name such as `Element.prototype.onclick`, Zone.js implements the `onProperty` patch logic by declaring all the event names in the source code, this increases the bundle size and also require updating the event names array to keep the information updated. Now google closure compiler has the required event names defined in the built-in externs files, so zone.js can use more simple implementation and decrease the bundle size of zone.js (about 4k).
044b343 to
cbea351
Compare
For legacy browsers, we still use the eventNames array to patch event instead of using `Object.getOwnPropertyNames()` to keep backward compatibility.
cbea351 to
22d8b18
Compare
|
FYI, the presubmit is "green", so I'm adding this PR to the merge queue. |
|
Note to the Caretaker: please sync this PR into g3 as a separate change. |
|
This does not merge cleanly with |
|
This PR was merged into the repository by commit 1b85811. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…e size (angular#40962) Zone.js supports the google closure compiler in the advance optimization mode, to prevent closure compiler modify the `onProperty` name such as `Element.prototype.onclick`, Zone.js implements the `onProperty` patch logic by declaring all the event names in the source code, this increases the bundle size and also require updating the event names array to keep the information updated. Now google closure compiler has the required event names defined in the built-in externs files, so zone.js can use more simple implementation and decrease the bundle size of zone.js (about 4k). PR Close angular#40962
…es (angular#40962) For legacy browsers, we still use the eventNames array to patch event instead of using `Object.getOwnPropertyNames()` to keep backward compatibility. PR Close angular#40962
Zone.js supports google closure compiler in advance optimization mode,
to prevent closure compiler modify the
onPropertyname such asElement.prototype.onclick,Zone.js implements the
onPropertypatch logic by declaring all theevent names in source code, this increases the bundle size and also require
updating the event names array to keep the information updated.
Now google closure compiler has the required event names defined in the built-in
externs files, so zone.js can use more simple implementation and decrease the bundle size
of zone.js. (about 3k)