| 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 |