mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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 |
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| output_from_observable_spec.ts | ||
| output_to_observable_spec.ts | ||
| take_until_destroyed_spec.ts | ||
| to_observable_spec.ts | ||
| to_signal_spec.ts | ||