Skip to content

Instantly share code, notes, and snippets.

@cartant
Created August 18, 2017 07:33
Show Gist options
  • Save cartant/50506a049a75c0b71770530362f24559 to your computer and use it in GitHub Desktop.
Save cartant/50506a049a75c0b71770530362f24559 to your computer and use it in GitHub Desktop.
export function publish<T>(
this: Observable<T>,
selector?: (source: Observable<T>) => Observable<T>
): Observable<T> | ConnectableObservable<T> {
return selector ?
multicast.call(this, () => new Subject<T>(), selector) :
multicast.call(this, new Subject<T>());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment