UNPKG

multitude

Version:

Comprehensive streams for push and pull

18 lines (17 loc) 1.3 kB
import { Push } from "../../../definitions"; import { Multicast } from '../../classes/Multicast'; export interface ShareOptions<U> extends Multicast.Options<U> { policy?: SharePolicy; } /** * 'on-demand': Default policy. Subscribes and re-subscribes to the original Observable once the resulting one has open subscriptions, so long as the original Observable hasn't errored or completed on previous subscriptions. Unsubscribes from the original Observable once the resulting Observable has no active subscriptions. * 'keep-open': Keeps the parent subscription open even if it has no current subscriptions. * 'keep-closed': Permanently unsubscribes from the original Observable once the resulting one has no active subscriptions. Subsequent subscriptions will error or complete immediately with the same signal as the original Observable if it finalized before being unsubscribed, or otherwise error. */ export declare type SharePolicy = 'on-demand' | 'keep-open' | 'keep-closed'; /** * Creates an Observable that multicasts the original Observable. * The original Observable won't be subscribed until there is at least * one subscriber. */ export declare function share<T, U extends T | void = T | void>(policy?: SharePolicy | ShareOptions<U>): Push.Transformation<T, Push.Multicast<T, U>>;