Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

timeInterval.js 1.1KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var async_1 = require("../scheduler/async");
  4. var scan_1 = require("./scan");
  5. var defer_1 = require("../observable/defer");
  6. var map_1 = require("./map");
  7. function timeInterval(scheduler) {
  8. if (scheduler === void 0) { scheduler = async_1.async; }
  9. return function (source) { return defer_1.defer(function () {
  10. return source.pipe(scan_1.scan(function (_a, value) {
  11. var current = _a.current;
  12. return ({ value: value, current: scheduler.now(), last: current });
  13. }, { current: scheduler.now(), value: undefined, last: undefined }), map_1.map(function (_a) {
  14. var current = _a.current, last = _a.last, value = _a.value;
  15. return new TimeInterval(value, current - last);
  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