aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/dist/esm5/internal/operators/refCount.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/rxjs/dist/esm5/internal/operators/refCount.js')
-rw-r--r--node_modules/rxjs/dist/esm5/internal/operators/refCount.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm5/internal/operators/refCount.js b/node_modules/rxjs/dist/esm5/internal/operators/refCount.js
new file mode 100644
index 0000000..ee0182d
--- /dev/null
+++ b/node_modules/rxjs/dist/esm5/internal/operators/refCount.js
@@ -0,0 +1,26 @@
+import { operate } from '../util/lift';
+import { createOperatorSubscriber } from './OperatorSubscriber';
+export function refCount() {
+ return operate(function (source, subscriber) {
+ var connection = null;
+ source._refCount++;
+ var refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, function () {
+ if (!source || source._refCount <= 0 || 0 < --source._refCount) {
+ connection = null;
+ return;
+ }
+ var sharedConnection = source._connection;
+ var conn = connection;
+ connection = null;
+ if (sharedConnection && (!conn || sharedConnection === conn)) {
+ sharedConnection.unsubscribe();
+ }
+ subscriber.unsubscribe();
+ });
+ source.subscribe(refCounter);
+ if (!refCounter.closed) {
+ connection = source.connect();
+ }
+ });
+}
+//# sourceMappingURL=refCount.js.map \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage