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