timeInterval.js 1.0 KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.TimeInterval = exports.timeInterval = void 0;
  4. var async_1 = require("../scheduler/async");
  5. var lift_1 = require("../util/lift");
  6. var OperatorSubscriber_1 = require("./OperatorSubscriber");
  7. function timeInterval(scheduler) {
  8. if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
  9. return lift_1.operate(function (source, subscriber) {
  10. var last = scheduler.now();
  11. source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
  12. var now = scheduler.now();
  13. var interval = now - last;
  14. last = now;
  15. subscriber.next(new TimeInterval(value, interval));
  16. }));
  17. });
  18. }
  19. exports.timeInterval = timeInterval;
  20. var TimeInterval = (function () {
  21. function TimeInterval(value, interval) {
  22. this.value = value;
  23. this.interval = interval;
  24. }
  25. return TimeInterval;
  26. }());
  27. exports.TimeInterval = TimeInterval;
  28. //# sourceMappingURL=timeInterval.js.map