UNPKG

multitude

Version:

Comprehensive streams for push and pull

27 lines (26 loc) 1.19 kB
import { Push } from "../../definitions"; import { Observable } from './Observable'; import { NullaryFn, UnaryFn } from 'type-core'; export declare namespace Multicast { interface Options<U> { /** Sets initial `multicast.value`; it won't be emitted. */ value?: U; replay?: boolean | number; } interface Hooks { onCreate?: UnaryFn<Multicast.Connect>; onSubscribe?: UnaryFn<Multicast.Connect>; onUnsubscribe?: UnaryFn<Multicast.Connect>; } type Connect = NullaryFn<Push.Subscription>; } export declare class Multicast<T = any, U extends T | void = T | void> extends Observable<T> implements Push.Multicast<T, U> { #private; static of<T>(item: T): Multicast<T, T>; static of<T>(item: T, options?: Multicast.Options<T>, hooks?: Multicast.Hooks): Multicast<T, T>; static from<T, U extends T | void = T | void>(item: Push.Convertible<T>, options?: Multicast.Options<U>, hooks?: Multicast.Hooks): Multicast<T, U>; constructor(subscriber: Push.Subscriber<T>, options?: Multicast.Options<U>, hooks?: Multicast.Hooks); get value(): T | U; get closed(): boolean; [Symbol.observable](): Observable<T>; }