UNPKG

1.27 kBTypeScriptView Raw
1import { Observable } from '../Observable';
2import { ConnectableObservable } from '../observable/ConnectableObservable';
3import { UnaryFunction } from '../types';
4/**
5 * Creates a {@link ConnectableObservable} that utilizes a {@link BehaviorSubject}.
6 *
7 * @param initialValue The initial value passed to the {@link BehaviorSubject}.
8 * @return A function that returns a {@link ConnectableObservable}
9 * @deprecated Will be removed in v8. To create a connectable observable that uses a
10 * {@link BehaviorSubject} under the hood, use {@link connectable}.
11 * `source.pipe(publishBehavior(initValue))` is equivalent to
12 * `connectable(source, { connector: () => new BehaviorSubject(initValue), resetOnDisconnect: false })`.
13 * If you're using {@link refCount} after `publishBehavior`, use the {@link share} operator instead.
14 * `source.pipe(publishBehavior(initValue), refCount())` is equivalent to
15 * `source.pipe(share({ connector: () => new BehaviorSubject(initValue), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.
16 * Details: https://rxjs.dev/deprecations/multicasting
17 */
18export declare function publishBehavior<T>(initialValue: T): UnaryFunction<Observable<T>, ConnectableObservable<T>>;
19//# sourceMappingURL=publishBehavior.d.ts.map
\No newline at end of file