Skip to main content
Module

x/rxjs/mod.ts>publish

Deno port of RXJS
Latest
function publish
Deprecated
Deprecated

Will be removed in v8. To create a connectable observable, use connectable. source.pipe(publish()) is equivalent to connectable(source, { connector: () => new Subject(), resetOnDisconnect: false }). If you're using refCount after publish, use share operator instead. source.pipe(publish(), refCount()) is equivalent to source.pipe(share({ resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })). Details: https://rxjs.dev/deprecations/multicasting

import { publish } from "https://deno.land/x/rxjs@v1.0.2/mod.ts";

Returns a connectable observable that, when connected, will multicast all values through a single underlying Subject instance.

Returns an observable, that when subscribed to, creates an underlying Subject, provides an observable view of it to a selector function, takes the observable result of that selector function and subscribes to it, sending its values to the consumer, then connects the subject to the original source.

Parameters

selector: (shared: Observable<T>) => O

A function used to setup multicasting prior to automatic connection.