Skip to content

Commit 5a04837

Browse files
JeanMechepkozlowski-opensource
authored andcommitted
refactor(core): replace non output EventEmitter with Subject. (angular#54666)
Semantcly we're shifting away from using `EventEmitter` on non-outputs. PR Close angular#54666
1 parent b23113d commit 5a04837

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/core/src/linker/query_list.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Observable} from 'rxjs';
9+
import {Observable, Subject} from 'rxjs';
1010

1111
import {EventEmitter} from '../event_emitter';
1212
import {Writable} from '../interface/type';
@@ -48,7 +48,7 @@ export class QueryList<T> implements Iterable<T> {
4848
private _onDirty?: () => void = undefined;
4949
private _results: Array<T> = [];
5050
private _changesDetected: boolean = false;
51-
private _changes: EventEmitter<QueryList<T>> | undefined = undefined;
51+
private _changes: Subject<QueryList<T>> | undefined = undefined;
5252

5353
readonly length: number = 0;
5454
readonly first: T = undefined!;
@@ -58,7 +58,7 @@ export class QueryList<T> implements Iterable<T> {
5858
* Returns `Observable` of `QueryList` notifying the subscriber of changes.
5959
*/
6060
get changes(): Observable<any> {
61-
return (this._changes ??= new EventEmitter());
61+
return (this._changes ??= new Subject());
6262
}
6363

6464
/**
@@ -171,7 +171,7 @@ export class QueryList<T> implements Iterable<T> {
171171
*/
172172
notifyOnChanges(): void {
173173
if (this._changes !== undefined && (this._changesDetected || !this._emitDistinctChangesOnly))
174-
this._changes.emit(this);
174+
this._changes.next(this);
175175
}
176176

177177
/** @internal */

0 commit comments

Comments
 (0)