diff options
Diffstat (limited to 'tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js')
-rw-r--r-- | tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js b/tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js index b18fdf17d0..716953ecdc 100644 --- a/tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js +++ b/tools/node_modules/eslint/node_modules/rxjs/internal/operators/shareReplay.js @@ -1,13 +1,24 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ReplaySubject_1 = require("../ReplaySubject"); -function shareReplay(bufferSize, windowTime, scheduler) { - if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; } - if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; } - return function (source) { return source.lift(shareReplayOperator(bufferSize, windowTime, scheduler)); }; +function shareReplay(configOrBufferSize, windowTime, scheduler) { + var config; + if (configOrBufferSize && typeof configOrBufferSize === 'object') { + config = configOrBufferSize; + } + else { + config = { + bufferSize: configOrBufferSize, + windowTime: windowTime, + refCount: false, + scheduler: scheduler + }; + } + return function (source) { return source.lift(shareReplayOperator(config)); }; } exports.shareReplay = shareReplay; -function shareReplayOperator(bufferSize, windowTime, scheduler) { +function shareReplayOperator(_a) { + var _b = _a.bufferSize, bufferSize = _b === void 0 ? Number.POSITIVE_INFINITY : _b, _c = _a.windowTime, windowTime = _c === void 0 ? Number.POSITIVE_INFINITY : _c, useRefCount = _a.refCount, scheduler = _a.scheduler; var subject; var refCount = 0; var subscription; @@ -31,13 +42,15 @@ function shareReplayOperator(bufferSize, windowTime, scheduler) { }); } var innerSub = subject.subscribe(this); - return function () { + this.add(function () { refCount--; innerSub.unsubscribe(); - if (subscription && refCount === 0 && isComplete) { + if (subscription && !isComplete && useRefCount && refCount === 0) { subscription.unsubscribe(); + subscription = undefined; + subject = undefined; } - }; + }); }; } //# sourceMappingURL=shareReplay.js.map
\ No newline at end of file |