Kargi-Sitesi/.angular/cache/18.2.11/babel-webpack/b6dd11c339a58458d44e9f5f7115210364e22e8b04cd651c574f26ba409a4752.json

1 line
13 KiB
JSON
Raw Permalink Normal View History

2024-11-04 02:30:09 +00:00
{"ast":null,"code":"import { SubjectSubscriber } from '../Subject';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nexport class ConnectableObservable extends Observable {\n constructor(source, subjectFactory) {\n super();\n this.source = source;\n this.subjectFactory = subjectFactory;\n this._refCount = 0;\n this._isComplete = false;\n }\n _subscribe(subscriber) {\n return this.getSubject().subscribe(subscriber);\n }\n getSubject() {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n }\n connect() {\n let connection = this._connection;\n if (!connection) {\n this._isComplete = false;\n connection = this._connection = new Subscription();\n connection.add(this.source.subscribe(new ConnectableSubscriber(this.getSubject(), this)));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n refCount() {\n return higherOrderRefCount()(this);\n }\n}\nexport const connectableObservableDescriptor = (() => {\n const connectableProto = ConnectableObservable.prototype;\n return {\n operator: {\n value: null\n },\n _refCount: {\n value: 0,\n writable: true\n },\n _subject: {\n value: null,\n writable: true\n },\n _connection: {\n value: null,\n writable: true\n },\n _subscribe: {\n value: connectableProto._subscribe\n },\n _isComplete: {\n value: connectableProto._isComplete,\n writable: true\n },\n getSubject: {\n value: connectableProto.getSubject\n },\n connect: {\n value: connectableProto.connect\n },\n refCount: {\n value: connectableProto.refCount\n }\n };\n})();\nclass ConnectableSubscriber extends SubjectSubscriber {\n constructor(destination, connectable) {\n super(destination);\n this.connectable = connectable;\n }\n _error(err) {\n this._unsubscribe();\n super._error(err);\n }\n _complete() {\n this.connectable._isComplete = true;\n this._unsubscribe();\n super._complete();\n }\n _unsubscribe() {\n const connectable = this.connectable;\n if (connectable) {\n this.connectable = null;\n const connection = connectable._connection;\n connectable._refCount = 0;\n connectable._subject = null;\n connectable._connection = null;\n if (connection) {\n connection.unsubscribe();\n }\n }\n }\n}\nclass RefCountOperator {\n constructor(connectable) {\n this.connectable = connectable;\n }\n call(subscriber, source) {\n const {\n connectable\n } = this;\n connectable._refCount++;\n const refCounter = new RefCountSubscriber(subscriber, connectable);\n const subscription = source.subscribe(refCounter);\n if (!refCounter.closed) {\n refCounter.connection = connectable.connect();\n }\n return subscription;\n }\n}\nclass RefCountSubscriber extends Subscriber {\n constructor(destination, connectable) {\n super(destination);\n this.connectable = connectable;\n }\n _unsubscribe() {\n const {\n connectable\n } = this;\n if (!connectable) {\n this.connection = null;\n return;\n }\n this.connectable = null;\n const refCount = connectable._refCount;\n if (refCount <= 0) {\n this.connection = null;\n return;\n }\n connectable._refCount = refCount - 1;\n if (refCount > 1) {\n this.connection = null;\n return;\n }\n const {\n connection\n } = this;\n const sharedConnection = connectable._connection;\n this.connection = null;\n if (sharedConnection && (!connection || sharedConnection === connection)) {\n sharedConnection.unsubscribe();\n }\n }\n}","map":{"version":3,"names":["SubjectSubscriber","O