angular/goldens/public-api/core
Paul Gschwendtner 866271a1c6 refactor(core): EventEmitter implements OutputRef. (#54650)
An `EventEmitter` is a construct owned by Angular that should be
used for outputs as of right now.

As we are introducing the new `OutputRef` interface for the new output
function APIs, we also think `EventEmitter` should implement
`OutputRef`— ensuring all "known" outputs follow the same contract.

This commit ensures `EventEmitter` implements an `OutputRef`

Note: An output ref captures the destroy ref from the current injection
context for clean-up purposes. This is also done for `EventEmitter` in a
backwards compatible way:

- not requiring an injection context. EventEmitter may be used
  elsewhere.
- not cleaning up subscriptions/completing the emitter when the
  directive/component is destroyed. This would be a change in behavior.

Note 2: The dependency on `DestroyRef` causes it to be retained in all
bundling examples because ironically `NgZone` uses `EventEmitter`- not
for outputs. The code is pretty minimal though, so that should be
acceptable.

`EventEmitter` will now always retain `NgZone. This increases the
payload size slightly around 800b for AIO. Note that the other increases
were coming from previous changes. This commit just pushed it over the
threshold.

PR Close #54650
2024-03-06 12:34:39 +01:00
..
primitives/signals refactor(core): rework runtime implementation to simplify and fix issues (#54103) 2024-02-06 15:04:36 +00:00
rxjs-interop feat(core): introduce outputToObservable interop helper (#54650) 2024-03-06 12:34:38 +01:00
testing refactor(core): Update ComponentFixture behavior when using zoneless scheduler (#54024) 2024-01-29 20:21:47 +00:00
errors.md feat(core): expose new output() API (#54650) 2024-03-06 12:34:38 +01:00
global_utils.md refactor(core): drop RootContext object (#47056) 2022-09-13 09:21:34 -07:00
index.md refactor(core): EventEmitter implements OutputRef. (#54650) 2024-03-06 12:34:39 +01:00