These are chat archives for pozadi/kefir

12th
Mar 2015
Jared Forsyth
@jaredly
Mar 12 2015 15:00
Sorry for all the question - I'm still getting used to Rx, figuring out all of the tricks. I have a stream that represents things to be rendered, and a stream for requestAnimationFrame. I basically want Kefir.sampledBy([renderStream], [rafStream]), except if the render stream doesn't produce any new values in between ticks, I don't want to re-render. So basically "output this pair no faster than the slower stream". Is there a simple way to do that?
Sergey Lapin
@lapanoid
Mar 12 2015 15:06
@jaredly I guess u can transform renderStream to property, It would not be triggered if it does not change
@jaredly or use skipDuplicates
But it does not solve last part.. In your case both streams are not passive. Kefir.sampledBy([renderStream], [rafStream]) - does not fit
Jared Forsyth
@jaredly
Mar 12 2015 15:14
ooh it looks like bufferBy does mostly what I want
Is there any pull-based backpressure-like stuff in kefir?
Sergey Lapin
@lapanoid
Mar 12 2015 15:17
Cool=) U just dont need to store intermediate render stuf, buffer will store it
lapanoid
Do I have any control should be my data stored or evaluated?
seems like properties solve that undercover
pozadi
If you need data to be evaluated through all chain at each request, it sounds like pull based FRP, but Kefir is push based.
lapanoid
Can it be both explicitly? I mean you always have two ways to deal with data, evaluate or store. Always store is a bad idea, always evaluate even worse. You can have some default behavior, but it can be cool option to make it possible to make some (okey) props "evaluable". Of course if it is not contadics your desigh philosophy of the library.
pozadi
You talking about property's current values right? Just to clarify :) Now it works automatically. Properties might evaluate data on "first request", but then will cache the result in this._current.
I think it theoretically possible to make this configurable, but not easy for sure.
lapanoid
It means you mostly keep it in memory
pozadi
I'm personally did have any problems with the fact that current value caches.
But you are right it spends some memory.
lapanoid
It became an issue if you operate with some big data occasionally
pozadi
Yes, might be an issue and Kefir doesn't help to solve this unfortunately.
We had discussion earlier with @pozadi , does it help?
Sergey Lapin
@lapanoid
Mar 12 2015 15:25
@jaredly cool stuff with https://jaredly.github.io/2015/03/06/visualizing-reactive-streams-hot-and-cold/ , there are other great visualization project - https://github.com/shamansir/rpd
Roman Pominov
@rpominov
Mar 12 2015 15:26
@jaredly yeah, bufferBy can help here
see sampledByAnimationsFrames
Sergey Lapin
@lapanoid
Mar 12 2015 15:29
I want this for kefir =) https://jaredly.github.io/rxvision/
Jared Forsyth
@jaredly
Mar 12 2015 15:29
@lapanoid :) I designed it such that it would be relatively simple to add support for other Rx libraries, and I've been thinking of adding Kefir support
Sergey Lapin
@lapanoid
Mar 12 2015 15:30
AWESOME
Roman Pominov
@rpominov
Mar 12 2015 15:31
@jaredly ah, it was you who wrote https://jaredly.github.io/2015/03/06/visualizing-reactive-streams-hot-and-cold/ :) very cool stuff, i finally get cold vs hot thing after reading this
Sergey Lapin
@lapanoid
Mar 12 2015 15:31
@pozadi mean @jaredly )
Roman Pominov
@rpominov
Mar 12 2015 15:31
Started from Bacon myself, so never got to deal with cold/hot
oh, sorry, yes
Jared Forsyth
@jaredly
Mar 12 2015 15:32
yup. glad it was helpful :)
Jared Forsyth
@jaredly
Mar 12 2015 15:42
So I ended up doing a custom withHandler, because I didn't want to call requestAnimationFrame when there wasn't anything to be rendered. It also allowed me to pool updates across streams