diff --git a/spec/observables/dom/animationFrames-spec.ts b/spec/observables/dom/animationFrames-spec.ts index a6a6d78942..761510f198 100644 --- a/spec/observables/dom/animationFrames-spec.ts +++ b/spec/observables/dom/animationFrames-spec.ts @@ -27,9 +27,9 @@ describe('animationFrames', () => { const result = mapped.pipe(mergeMapTo(animationFrames())); expectObservable(result, subs).toBe(expected, { - a: ta - tm, - b: tb - tm, - c: tc - tm, + a: { elapsed: ta - tm, timestamp: ta }, + b: { elapsed: tb - tm, timestamp: tb }, + c: { elapsed: tc - tm, timestamp: tc }, }); }); }); @@ -50,9 +50,9 @@ describe('animationFrames', () => { const result = mapped.pipe(mergeMapTo(animationFrames(timestampProvider))); expectObservable(result, subs).toBe(expected, { - a: 50, - b: 150, - c: 250, + a: { elapsed: 50, timestamp: 100 }, + b: { elapsed: 150, timestamp: 200 }, + c: { elapsed: 250, timestamp: 300 }, }); }); }); @@ -71,8 +71,8 @@ describe('animationFrames', () => { const result = mapped.pipe(mergeMapTo(animationFrames().pipe(take(2)))); expectObservable(result).toBe(expected, { - a: ta - tm, - b: tb - tm, + a: { elapsed: ta - tm, timestamp: ta }, + b: { elapsed: tb - tm, timestamp: tb }, }); testScheduler.flush(); @@ -98,8 +98,8 @@ describe('animationFrames', () => { const result = mapped.pipe(mergeMapTo(animationFrames().pipe(takeUntil(signal)))); expectObservable(result).toBe(expected, { - a: ta - tm, - b: tb - tm, + a: { elapsed: ta - tm, timestamp: ta }, + b: { elapsed: tb - tm, timestamp: tb }, }); testScheduler.flush(); diff --git a/src/internal/observable/dom/animationFrames.ts b/src/internal/observable/dom/animationFrames.ts index 665160c432..6fcd2217ca 100644 --- a/src/internal/observable/dom/animationFrames.ts +++ b/src/internal/observable/dom/animationFrames.ts @@ -1,7 +1,7 @@ import { Observable } from '../../Observable'; import { Subscription } from '../../Subscription'; import { TimestampProvider } from "../../types"; -import { dateTimestampProvider } from '../../scheduler/dateTimestampProvider'; +import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider'; import { requestAnimationFrameProvider } from '../../scheduler/requestAnimationFrameProvider'; /** @@ -91,7 +91,7 @@ function animationFramesFactory(timestampProvider?: TimestampProvider) { // If no timestamp provider is specified, use performance.now() - as it // will return timestamps 'compatible' with those passed to the run // callback and won't be affected by NTP adjustments, etc. - const provider = timestampProvider || performance; + const provider = timestampProvider || performanceTimestampProvider; // Capture the start time upon subscription, as the run callback can remain // queued for a considerable period of time and the elapsed time should // represent the time elapsed since subscription - not the time since the