Skip to content

fix(zone.js): change EventTarget methods zone.js added optional#35954

Closed
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:zone-event-target-optional
Closed

fix(zone.js): change EventTarget methods zone.js added optional#35954
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:zone-event-target-optional

Conversation

@JiaLiPassion
Copy link
Copy Markdown
Contributor

zone.js add 2 methods in EventTarget.prototype, but those methods only exists when user import zone.js and also enable EventTarget monkey patch.
If user

  1. Not importing zone.js and use noop zone when bootstrapping Angular app.
  2. Or disable monkey patching zone.js EventTarget patch by defining __Zone_disable_EventTarget = true.

Those methods will not be there.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

@JiaLiPassion JiaLiPassion added area: zones Issues related to zone.js target: major This PR is targeted for the next major release labels Mar 9, 2020
@JiaLiPassion JiaLiPassion requested a review from mhevery March 9, 2020 10:52
@ngbot ngbot Bot added this to the needsTriage milestone Mar 9, 2020
Copy link
Copy Markdown
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

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

LGTM, please change the commit msg:

fix(zone.js): Make `EventTarget` methods optional in `zone.js` extension API

`zone.js` added `removeAllListeners` and `eventListeners` methods in `EventTarget.prototype`, but those methods only exists when user import `zone.js` and also enables `EventTarget` monkey patching.

If user:
1. Does not import `zone.js` and uses `noop` zone when bootstrapping Angular app. OR
2. Disable monkey patching of `EventTarget` patch by defining `__Zone_disable_EventTarget = true`.

Then `removeAllListeners` and `eventListeners`  methods will not be present.

@mhevery mhevery added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: merge The PR is ready for merge by the caretaker labels Mar 9, 2020
@ngbot
Copy link
Copy Markdown

ngbot Bot commented Mar 9, 2020

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/angular: size" is failing
    failure status "ci/circleci: test_ivy_aot" is failing
    pending forbidden labels detected: PR action: cleanup
    pending status "google3" is pending
    pending missing required status "ci/circleci: publish_snapshot"

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

…ion API

`zone.js` added `removeAllListeners` and `eventListeners` methods in `EventTarget.prototype`, but those methods only exists when user import `zone.js` and also enables `EventTarget` monkey patching.

If user:
1. Does not import `zone.js` and uses `noop` zone when bootstrapping Angular app. OR
2. Disable monkey patching of `EventTarget` patch by defining `__Zone_disable_EventTarget = true`.

Then `removeAllListeners` and `eventListeners`  methods will not be present.
@JiaLiPassion JiaLiPassion force-pushed the zone-event-target-optional branch from e22e3fa to 5ceb2eb Compare March 9, 2020 15:51
@JiaLiPassion JiaLiPassion removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Mar 9, 2020
@JiaLiPassion
Copy link
Copy Markdown
Contributor Author

@mhevery , thank you for the review, I have updated the PR.

@matsko
Copy link
Copy Markdown
Contributor

matsko commented Mar 11, 2020

@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Mar 11, 2020
@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label Mar 16, 2020
@AndrewKushnir
Copy link
Copy Markdown
Contributor

FYI, changes in this PR were tested against g3 as a part of #36043, using Global TAP run, which was successful. Thank you.

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: zones Issues related to zone.js cla: yes target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants