2 var __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);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subject_1 = require("../Subject");
17 var innerSubscribe_1 = require("../innerSubscribe");
18 function window(windowBoundaries) {
19 return function windowOperatorFunction(source) {
20 return source.lift(new WindowOperator(windowBoundaries));
23 exports.window = window;
24 var WindowOperator = (function () {
25 function WindowOperator(windowBoundaries) {
26 this.windowBoundaries = windowBoundaries;
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)));
34 return sourceSubscription;
36 return WindowOperator;
38 var 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);
46 WindowSubscriber.prototype.notifyNext = function () {
49 WindowSubscriber.prototype.notifyError = function (error) {
52 WindowSubscriber.prototype.notifyComplete = function () {
55 WindowSubscriber.prototype._next = function (value) {
56 this.window.next(value);
58 WindowSubscriber.prototype._error = function (err) {
59 this.window.error(err);
60 this.destination.error(err);
62 WindowSubscriber.prototype._complete = function () {
63 this.window.complete();
64 this.destination.complete();
66 WindowSubscriber.prototype._unsubscribe = function () {
69 WindowSubscriber.prototype.openWindow = function () {
70 var prevWindow = this.window;
72 prevWindow.complete();
74 var destination = this.destination;
75 var newWindow = this.window = new Subject_1.Subject();
76 destination.next(newWindow);
78 return WindowSubscriber;
79 }(innerSubscribe_1.SimpleOuterSubscriber));
80 //# sourceMappingURL=window.js.map