source: trip-planner-front/node_modules/rxjs/internal/operators/window.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var Subject_1 = require("../Subject");
17var innerSubscribe_1 = require("../innerSubscribe");
18function window(windowBoundaries) {
19 return function windowOperatorFunction(source) {
20 return source.lift(new WindowOperator(windowBoundaries));
21 };
22}
23exports.window = window;
24var WindowOperator = (function () {
25 function WindowOperator(windowBoundaries) {
26 this.windowBoundaries = windowBoundaries;
27 }
28 WindowOperator.prototype.call = function (subscriber, source) {
29 var windowSubscriber = new WindowSubscriber(subscriber);
30 var sourceSubscription = source.subscribe(windowSubscriber);
31 if (!sourceSubscription.closed) {
32 windowSubscriber.add(innerSubscribe_1.innerSubscribe(this.windowBoundaries, new innerSubscribe_1.SimpleInnerSubscriber(windowSubscriber)));
33 }
34 return sourceSubscription;
35 };
36 return WindowOperator;
37}());
38var WindowSubscriber = (function (_super) {
39 __extends(WindowSubscriber, _super);
40 function WindowSubscriber(destination) {
41 var _this = _super.call(this, destination) || this;
42 _this.window = new Subject_1.Subject();
43 destination.next(_this.window);
44 return _this;
45 }
46 WindowSubscriber.prototype.notifyNext = function () {
47 this.openWindow();
48 };
49 WindowSubscriber.prototype.notifyError = function (error) {
50 this._error(error);
51 };
52 WindowSubscriber.prototype.notifyComplete = function () {
53 this._complete();
54 };
55 WindowSubscriber.prototype._next = function (value) {
56 this.window.next(value);
57 };
58 WindowSubscriber.prototype._error = function (err) {
59 this.window.error(err);
60 this.destination.error(err);
61 };
62 WindowSubscriber.prototype._complete = function () {
63 this.window.complete();
64 this.destination.complete();
65 };
66 WindowSubscriber.prototype._unsubscribe = function () {
67 this.window = null;
68 };
69 WindowSubscriber.prototype.openWindow = function () {
70 var prevWindow = this.window;
71 if (prevWindow) {
72 prevWindow.complete();
73 }
74 var destination = this.destination;
75 var newWindow = this.window = new Subject_1.Subject();
76 destination.next(newWindow);
77 };
78 return WindowSubscriber;
79}(innerSubscribe_1.SimpleOuterSubscriber));
80//# sourceMappingURL=window.js.map
Note: See TracBrowser for help on using the repository browser.