kosich / rxjs-proxify

Turns a Stream of Objects into an Object of Streams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

proxify(stream) with distinct values

magne4000 opened this issue · comments

I have a readable Observable State, not created by statify, used with proxify, and I would like to have the ability to have a distinctUntilChanged on each property like statify does.

My use case is making a redux state Observable (readonly at first) through this lib.

Hey! A very interesting use-case, I'd love to hear more about your project.

Currently, the functionality you're asking for is present already but is not currently exported.
Here's the core function, that is used by both proxify and statify and that has a distinct flag doing the trick https://github.com/kosich/rxjs-proxify/blob/master/src/core/proxy.ts#L7

And currently, you can import that function (in a hacky way):

import { coreProxy } from "rxjs-proxify/dist/cjs/core/proxy.js";

Here's a full example using that fn: https://stackblitz.com/edit/rxjs-proxify-distincted-proxify-example?file=index.ts

As I understand, you're working on a PoC. Please, give the example above a try, and if everything goes fine — I'll add the flag to the official API with the next release, so that you won't have to rely on the internals.

GL

Just tried it, it works exactly as I needed!