Figuring out join combinators.
alexander-matsievsky opened this issue · comments
Good day!
Please take a look at this. It is an implementation of a reference TodoMVC app.
The solution works as advertised. Nevertheless, I feel I'm missing something about joining streams.
update
function
At first I though that would work:
if (error) {
return new Bacon.Error(error);
} else {
return new Bacon.Next([todos, todo]);
}
but had to settle for a solution with node-like running state:
if (error) {
return [todos, error, null];
} else {
return [todos, null, todo];
}
Is my reasoning flawed?
when
joins
The update
stream holds the the current todo-list :Todo[]
and the last change with full info :Todo
(whether creation, update or deletion). This code block extracts this change in a categorized way. My question is whether I'm doing it right or there is a better way to handle a situation like
POST
triggered anupdate
. Get the events fromupdate
initiated byPOST
and skip the ones triggered byPUT
andDELETE
.
@raimohanska Could you help me out with the above issue?
sorry I'm a bit busy. maybe someone else has time to review the code?
@raimohanska Yes, of course. Thanx for an amazing library!+)