bc282cc81bac395596e6bd632cdd6b1316fe54596f5c5221494ceb443e40dca78e474f1d77e0abff3cc08a810cff6ea293bcbc2f9242b254e1c9adbba41d20 739 B

123456789101112131415161718192021
  1. import { asyncScheduler } from '../scheduler/async';
  2. import { operate } from '../util/lift';
  3. import { createOperatorSubscriber } from './OperatorSubscriber';
  4. export function timeInterval(scheduler = asyncScheduler) {
  5. return operate((source, subscriber) => {
  6. let last = scheduler.now();
  7. source.subscribe(createOperatorSubscriber(subscriber, (value) => {
  8. const now = scheduler.now();
  9. const interval = now - last;
  10. last = now;
  11. subscriber.next(new TimeInterval(value, interval));
  12. }));
  13. });
  14. }
  15. export class TimeInterval {
  16. constructor(value, interval) {
  17. this.value = value;
  18. this.interval = interval;
  19. }
  20. }
  21. //# sourceMappingURL=timeInterval.js.map