Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/rxjs/src/operators/ |
Upload File : |
import { Subject } from '../Subject'; import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { Observable } from '../Observable'; import { ConnectableObservable, connectableObservableDescriptor } from '../observable/ConnectableObservable'; import { FactoryOrValue, MonoTypeOperatorFunction, OperatorFunction, UnaryFunction } from '../interfaces'; /* tslint:disable:max-line-length */ export function multicast<T>(subjectOrSubjectFactory: FactoryOrValue<Subject<T>>): UnaryFunction<Observable<T>, ConnectableObservable<T>>; export function multicast<T>(SubjectFactory: (this: Observable<T>) => Subject<T>, selector?: MonoTypeOperatorFunction<T>): MonoTypeOperatorFunction<T>; export function multicast<T, R>(SubjectFactory: (this: Observable<T>) => Subject<T>, selector?: OperatorFunction<T, R>): OperatorFunction<T, R>; /* tslint:enable:max-line-length */ /** * Returns an Observable that emits the results of invoking a specified selector on items * emitted by a ConnectableObservable that shares a single subscription to the underlying stream. * * <img src="./img/multicast.png" width="100%"> * * @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through * which the source sequence's elements will be multicast to the selector function * or Subject to push source elements into. * @param {Function} [selector] - Optional selector function that can use the multicasted source stream * as many times as needed, without causing multiple subscriptions to the source stream. * Subscribers to the given source will receive all notifications of the source from the * time of the subscription forward. * @return {Observable} An Observable that emits the results of invoking the selector * on the items emitted by a `ConnectableObservable` that shares a single subscription to * the underlying stream. * @method multicast * @owner Observable */ export function multicast<T, R>(subjectOrSubjectFactory: Subject<T> | (() => Subject<T>), selector?: (source: Observable<T>) => Observable<R>): OperatorFunction<T, R> { return function multicastOperatorFunction(source: Observable<T>): Observable<R> { let subjectFactory: () => Subject<T>; if (typeof subjectOrSubjectFactory === 'function') { subjectFactory = <() => Subject<T>>subjectOrSubjectFactory; } else { subjectFactory = function subjectFactory() { return <Subject<T>>subjectOrSubjectFactory; }; } if (typeof selector === 'function') { return source.lift(new MulticastOperator(subjectFactory, selector)); } const connectable: any = Object.create(source, connectableObservableDescriptor); connectable.source = source; connectable.subjectFactory = subjectFactory; return <ConnectableObservable<R>> connectable; }; } export class MulticastOperator<T, R> implements Operator<T, R> { constructor(private subjectFactory: () => Subject<T>, private selector: (source: Observable<T>) => Observable<R>) { } call(subscriber: Subscriber<R>, source: any): any { const { selector } = this; const subject = this.subjectFactory(); const subscription = selector(subject).subscribe(subscriber); subscription.add(source.subscribe(subject)); return subscription; } }