Skip to main content

sourceObservablePipe

Types

function sourceObservable<GValue>(
subscribe: IObservable<GValue>,
options: ISourceObservableOptions<GValue>,
): IObservable<GValue>
interface ISourceObservableOptions<GValue> {
createSource: ISourceObservablePipeCreateSource<GValue>;
onSubscribe: ISourceObservableOnSubscribeFunction<GValue>;
onUnsubscribe: ISourceObservableOnUnsubscribeFunction<GValue>;
}

interface ISourceObservablePipeCreateSource<GValue> {
(): ISource<GValue>;
}


interface ISourceObservableOnSubscribeFunction<GValue> {
(
emit: IObserver<GValue>,
): boolean;
}

interface ISourceObservableOnUnsubscribeFunction<GValue> {
(
emit: IObserver<GValue>,
): boolean;
}

Definition

This ObservablePipe does the bridge between a Source which is not lazy loaded, and an Observable (which is lazy loaded).

Its purpose is to subscribe to the provided Observable when onSubscribe returns true, and unsubscribe to it when onUnsubscribe returns true.

onSubscribe and onUnsubscribe are called everytime the returned Observable is subscribed or unsubscribed respectively.

caution

You will probably never user directly this ObservablePipe, instead you may use: shareObservablePipeWithMulticastReplaySource or shareObservablePipeWithMulticastReplayLastSource.