1 | import { Subscription } from '../Subscription';
|
---|
2 | import { InnerSubscriber } from '../InnerSubscriber';
|
---|
3 | import { OuterSubscriber } from '../OuterSubscriber';
|
---|
4 | import { Subscriber } from '../Subscriber';
|
---|
5 | import { subscribeTo } from './subscribeTo';
|
---|
6 | import { Observable } from '../Observable';
|
---|
7 |
|
---|
8 | export function subscribeToResult<T, R>(
|
---|
9 | outerSubscriber: OuterSubscriber<T, R>,
|
---|
10 | result: any,
|
---|
11 | outerValue: undefined,
|
---|
12 | outerIndex: undefined,
|
---|
13 | innerSubscriber: InnerSubscriber<T, R>
|
---|
14 | ): Subscription | undefined;
|
---|
15 |
|
---|
16 | export function subscribeToResult<T, R>(
|
---|
17 | outerSubscriber: OuterSubscriber<T, R>,
|
---|
18 | result: any,
|
---|
19 | outerValue?: T,
|
---|
20 | outerIndex?: number
|
---|
21 | ): Subscription | undefined;
|
---|
22 |
|
---|
23 | export function subscribeToResult<T, R>(
|
---|
24 | outerSubscriber: OuterSubscriber<T, R>,
|
---|
25 | result: any,
|
---|
26 | outerValue?: T,
|
---|
27 | outerIndex?: number,
|
---|
28 | innerSubscriber: Subscriber<R> = new InnerSubscriber(outerSubscriber, outerValue, outerIndex)
|
---|
29 | ): Subscription | undefined {
|
---|
30 | if (innerSubscriber.closed) {
|
---|
31 | return undefined;
|
---|
32 | }
|
---|
33 | if (result instanceof Observable) {
|
---|
34 | return result.subscribe(innerSubscriber);
|
---|
35 | }
|
---|
36 | return subscribeTo(result)(innerSubscriber) as Subscription;
|
---|
37 | }
|
---|