Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / window.js
1 "use strict";
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);
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 })();
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subject_1 = require("../Subject");
17 var OuterSubscriber_1 = require("../OuterSubscriber");
18 var subscribeToResult_1 = require("../util/subscribeToResult");
19 function window(windowBoundaries) {
20     return function windowOperatorFunction(source) {
21         return source.lift(new WindowOperator(windowBoundaries));
22     };
23 }
24 exports.window = window;
25 var WindowOperator = (function () {
26     function WindowOperator(windowBoundaries) {
27         this.windowBoundaries = windowBoundaries;
28     }
29     WindowOperator.prototype.call = function (subscriber, source) {
30         var windowSubscriber = new WindowSubscriber(subscriber);
31         var sourceSubscription = source.subscribe(windowSubscriber);
32         if (!sourceSubscription.closed) {
33             windowSubscriber.add(subscribeToResult_1.subscribeToResult(windowSubscriber, this.windowBoundaries));
34         }
35         return sourceSubscription;
36     };
37     return WindowOperator;
38 }());
39 var WindowSubscriber = (function (_super) {
40     __extends(WindowSubscriber, _super);
41     function WindowSubscriber(destination) {
42         var _this = _super.call(this, destination) || this;
43         _this.window = new Subject_1.Subject();
44         destination.next(_this.window);
45         return _this;
46     }
47     WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
48         this.openWindow();
49     };
50     WindowSubscriber.prototype.notifyError = function (error, innerSub) {
51         this._error(error);
52     };
53     WindowSubscriber.prototype.notifyComplete = function (innerSub) {
54         this._complete();
55     };
56     WindowSubscriber.prototype._next = function (value) {
57         this.window.next(value);
58     };
59     WindowSubscriber.prototype._error = function (err) {
60         this.window.error(err);
61         this.destination.error(err);
62     };
63     WindowSubscriber.prototype._complete = function () {
64         this.window.complete();
65         this.destination.complete();
66     };
67     WindowSubscriber.prototype._unsubscribe = function () {
68         this.window = null;
69     };
70     WindowSubscriber.prototype.openWindow = function () {
71         var prevWindow = this.window;
72         if (prevWindow) {
73             prevWindow.complete();
74         }
75         var destination = this.destination;
76         var newWindow = this.window = new Subject_1.Subject();
77         destination.next(newWindow);
78     };
79     return WindowSubscriber;
80 }(OuterSubscriber_1.OuterSubscriber));
81 //# sourceMappingURL=window.js.map