MCPcopy
hub / github.com/angular/angularfire / listChanges

Function listChanges

src/compat/database/list/changes.ts:8–17  ·  view source on GitHub ↗
(ref: DatabaseQuery, events: ChildEvent[], scheduler?: SchedulerLike)

Source from the content-addressed store, hash-verified

6
7
8export function listChanges<T = any>(ref: DatabaseQuery, events: ChildEvent[], scheduler?: SchedulerLike): Observable<SnapshotAction<T>[]> {
9 return fromRef(ref, 'value', 'once', scheduler).pipe(
10 switchMap(snapshotAction => {
11 const childEvent$ = [of(snapshotAction)];
12 events.forEach(event => childEvent$.push(fromRef(ref, event, 'on', scheduler)));
13 return merge(...childEvent$).pipe(scan(buildView, []));
14 }),
15 distinctUntilChanged()
16 );
17}
18
19function positionFor<T>(changes: SnapshotAction<T>[], key) {
20 const len = changes.length;

Callers 2

snapshotChangesFunction · 0.90
changes.spec.tsFile · 0.90

Calls 3

fromRefFunction · 0.90
pushMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected