combineLatest.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. "use strict";
  2. var __read = (this && this.__read) || function (o, n) {
  3. var m = typeof Symbol === "function" && o[Symbol.iterator];
  4. if (!m) return o;
  5. var i = m.call(o), r, ar = [], e;
  6. try {
  7. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  8. }
  9. catch (error) { e = { error: error }; }
  10. finally {
  11. try {
  12. if (r && !r.done && (m = i["return"])) m.call(i);
  13. }
  14. finally { if (e) throw e.error; }
  15. }
  16. return ar;
  17. };
  18. var __spreadArray = (this && this.__spreadArray) || function (to, from) {
  19. for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
  20. to[j] = from[i];
  21. return to;
  22. };
  23. Object.defineProperty(exports, "__esModule", { value: true });
  24. exports.combineLatest = void 0;
  25. var combineLatest_1 = require("../observable/combineLatest");
  26. var lift_1 = require("../util/lift");
  27. var argsOrArgArray_1 = require("../util/argsOrArgArray");
  28. var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
  29. var pipe_1 = require("../util/pipe");
  30. var args_1 = require("../util/args");
  31. function combineLatest() {
  32. var args = [];
  33. for (var _i = 0; _i < arguments.length; _i++) {
  34. args[_i] = arguments[_i];
  35. }
  36. var resultSelector = args_1.popResultSelector(args);
  37. return resultSelector
  38. ? pipe_1.pipe(combineLatest.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector))
  39. : lift_1.operate(function (source, subscriber) {
  40. combineLatest_1.combineLatestInit(__spreadArray([source], __read(argsOrArgArray_1.argsOrArgArray(args))))(subscriber);
  41. });
  42. }
  43. exports.combineLatest = combineLatest;
  44. //# sourceMappingURL=combineLatest.js.map