window.js 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.window = void 0;
  4. var Subject_1 = require("../Subject");
  5. var lift_1 = require("../util/lift");
  6. var OperatorSubscriber_1 = require("./OperatorSubscriber");
  7. var noop_1 = require("../util/noop");
  8. var innerFrom_1 = require("../observable/innerFrom");
  9. function window(windowBoundaries) {
  10. return lift_1.operate(function (source, subscriber) {
  11. var windowSubject = new Subject_1.Subject();
  12. subscriber.next(windowSubject.asObservable());
  13. var errorHandler = function (err) {
  14. windowSubject.error(err);
  15. subscriber.error(err);
  16. };
  17. source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.next(value); }, function () {
  18. windowSubject.complete();
  19. subscriber.complete();
  20. }, errorHandler));
  21. innerFrom_1.innerFrom(windowBoundaries).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
  22. windowSubject.complete();
  23. subscriber.next((windowSubject = new Subject_1.Subject()));
  24. }, noop_1.noop, errorHandler));
  25. return function () {
  26. windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.unsubscribe();
  27. windowSubject = null;
  28. };
  29. });
  30. }
  31. exports.window = window;
  32. //# sourceMappingURL=window.js.map