Skip to content

feat(core): add event listener options to renderer#59092

Closed
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:listener-options
Closed

feat(core): add event listener options to renderer#59092
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:listener-options

Conversation

@crisbeto
Copy link
Copy Markdown
Member

@crisbeto crisbeto commented Dec 6, 2024

Updates the Renderer2.listen signature to accept event options, as well as all adjacent types to it.

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Dec 6, 2024
@ngbot ngbot bot added this to the Backlog milestone Dec 6, 2024
Updates the `Renderer2.listen` signature to accept event options, as well as all adjacent types to it.
@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Dec 6, 2024
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Dec 6, 2024
@crisbeto crisbeto marked this pull request as ready for review December 6, 2024 17:59
}): WritableSignal<D>;

// @public
export interface ListenerOptions {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Initially I wanted to call this EventListenerOptions, but that's the same name as the native type.

"name": "InputFlags"
},
{
"name": "KeyEventsPlugin"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we start to get those symbols all of the sudden?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure, but it's weird given that I only added a type and type-only imports. I approved the diffs, because I think that those symbols have always been there. AFAIK we don't have a way to tree shake them even if we wanted to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I spent some time going through all the changes, and I'm convinced that this is an infra quirk, rather than the symbols changing. As soon as I add any parameter to DomEventsPlugin.removeEventListener, the bundle golden needs to be updated. Here's a minimal repro: crisbeto@bf50e54. All I did was add the options parameter, pass the parameter into the removeEventListener callback and run yarn bazel run //packages/core/test/bundling/standalone_bootstrap:symbol_test.accept.

Copy link
Copy Markdown
Member

@JeanMeche JeanMeche Dec 9, 2024

Choose a reason for hiding this comment

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

What's suprising to me is that they weren't here before. Them being being listed is actually normal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. The DomEventsPlugin is provided eagerly here https://github.com/angular/angular/blob/main/packages/platform-browser/src/browser.ts#L238. I don't think there's a way to tree shake it away from there. There's also the fact that if it was tree shaken, Angular wouldn't be able to bind events in the browser.

Copy link
Copy Markdown
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

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

Reviewed-for: public-api

@pullapprove pullapprove bot requested a review from thePunderWoman December 9, 2024 17:59
Copy link
Copy Markdown
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Reviewed-for: public-api

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 9, 2024
@alxhub
Copy link
Copy Markdown
Member

alxhub commented Dec 10, 2024

This PR was merged into the repository by commit d010e11.

The changes were merged into the following branches: main

@alxhub alxhub closed this in d010e11 Dec 10, 2024
@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 Jan 10, 2025
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
Updates the `Renderer2.listen` signature to accept event options, as well as all adjacent types to it.

PR Close angular#59092
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: core Issues related to the framework runtime detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants