@niwinz is there some utility or so in beicon that helps me turn a callback based API into a stream?
Could probably whip up something myself just wondered if there’s some utility for that 🙂
I guess a debouncer mixin might be better since I can reuse that easier in other components
Hm. Something with my get-completions!
function is still wrong, Can’t get the StartPlacesAutocompletion
. Seems when I merge one ended stream with another one it ends it too? Or something like that? 😄
Ah! — rx/subject
!
Hm, still doesn’t quite work...
@martinklepsch (rx/map (fn [x] (get-completions! serv x)))
is wrong
it should be mapcat
I tried mapcat
then I think that get completions is also wrong
yeah, I think the culprit is somewhere in that get-completions
fn
it returns a stream that never finishes
that is the objective of get completions?
Also tried rx/end
instead of rx/push!
The objective is to return a stream with one item
ok
so rx/push!
and then rx/end!
(rx/end! subject)
uh, weird. I tried (end! subject thing)
and thought it would put thing
on the stream and end it.
On the end you have two ways convert callback code to rx streams returning code
using rx/create or using rx/subject in the way as you have used it
There was no exception for the (end! subject thing)
with the finally calling rx/end! on subject
the thing
is just ignored because end! only has arity 1
right but shouldn’t it cause an error then, calling a function with wrong arity?
no, in javascript no...
maybe I’m remembering wrongly what I did, will re-check later
oh, ok, that’s rough 😄
never consciously ran into that
@niwinz generally would that be the approach you would take or would you use component lifecycle, decouple debounce & actual action, .... ?
It depends, but if you want to debounce, probably I will use the component stuff
I guess question is if you think this is a good area for RX over other solutions
debounce for UI stuff
on the other hand, this not looks bad
I’m also tending towards using component lifecycle now mostly because I can make the debounce stuff separate to the action I’m doing after debounce
(which is coupled here and not really nice I’d say)
+1
I agree with that