Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import * as memoize from 'memoize'
import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/share'
import 'rxjs/add/operator/distinctUntilChanged'
export interface Selector<T,V> {
( source$: Observable<T> ): Observable<V>
export interface SelectorFactory<T,V> {
( ...args: any[] ): Selector<T,V>
export function publishDistinct<T,V>(
source$: Observable<T>,
selectorFactory: SelectorFactory<T,V>
): (...args: any[]) => Observable<V> {
return memoize(
( ...args: any[] ) => selectorFactory( ...args )( source$ )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.