Closed cocodrino closed 6 years ago
Hello @cocodrino
What exactly do you mean with a Rx module? How many of the Rx functions should it contain?
For an implementation of a debounce
function you might get inspiration from the afterSilence
. I'd like to see your implementation :)
debounce could be implemented using the composition of afterSilence
, and last
:
const last = xs => xs[xs.length - 1];
const debounceTime = time => value$ => value$
.pipe(afterSilence(time))
.map(last)
Or using chain
:
const afterTime = time => value => {
const value$ = flyd.stream();
setTimeout(()=> value$(value), time);
return value$;
};
const debounceTime = time => value$ => value$
.chain(afterTime(time))
I think a great thing about flyd is how minimal it is.
Hi @paldepind I think than would be nice provide a rx module with the most used Rx functions, they're just only a bunch of basic functions
http://rxmarbles.com
could you give me an implementation of debounce function?..I did my own but I consider the result pretty poor, would be nice watch the correct implementation.
thanks!