wishthis/node_modules/rxjs/dist/cjs/internal/operators/window.js

32 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-06-08 10:36:39 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.window = void 0;
var Subject_1 = require("../Subject");
var lift_1 = require("../util/lift");
var OperatorSubscriber_1 = require("./OperatorSubscriber");
var noop_1 = require("../util/noop");
2023-02-08 12:35:10 +00:00
var innerFrom_1 = require("../observable/innerFrom");
2022-06-08 10:36:39 +00:00
function window(windowBoundaries) {
return lift_1.operate(function (source, subscriber) {
var windowSubject = new Subject_1.Subject();
subscriber.next(windowSubject.asObservable());
var errorHandler = function (err) {
windowSubject.error(err);
subscriber.error(err);
};
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.next(value); }, function () {
windowSubject.complete();
subscriber.complete();
}, errorHandler));
2023-02-08 12:35:10 +00:00
innerFrom_1.innerFrom(windowBoundaries).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
2022-06-08 10:36:39 +00:00
windowSubject.complete();
subscriber.next((windowSubject = new Subject_1.Subject()));
}, noop_1.noop, errorHandler));
return function () {
windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.unsubscribe();
windowSubject = null;
};
});
}
exports.window = window;
//# sourceMappingURL=window.js.map