Closed ericholiveira closed 9 years ago
Hi!
You can create same behavior as in obs.bufferWithTime(delay)
pretty easily with the current API:
obs.bufferBy(Kefir.interval(delay));
So I'd say, we don't need it. Other two can be done using .bufferWhile
, but it won't be so smooth as above:
function bufferWithCount(obs, count) {
var curCount = count;
obs.bufferWhile(function() {
curCount--;
if (curCount === 0) {
curCount = count;
return false;
} else {
return true;
}
});
}
... similar for bufferWithTimeOrCount
.
I'd add bufferWithCount
and bufferWithTimeOrCount
, but we need good use cases for them first. As I understand, you only need bufferWithTime
for now, right?
Cool, Roman. Thx for the help, if i need bufferWithCount i'll let you know
:+1:
if i need bufferWithCount i'll let you know
Please do!
Hi, i discovered Kefir today and tried in some projects to check the performance improvement and its amazing. But i have a problem, buffer a stream for a period of time is a common task in my project, and I know I can implement this by myself but i would love to see it in the main API. So i wanna know if you plain to have bufferWithTime, bufferWithCount and bufferWithTimeOrCount on the main API. I can do a PR with the implementation if you're interested.