In the following example (from the Collections README), it sounds as though the third argument is acting as a filter:
function TodoList (sources) {
const addTodo$ = sources.DOM
.select('.add-todo')
.events('click')
.mapTo(null); // to prevent adding click events as sources
const todoListItems$ = Collection(TodoListItem, sources, addTodo$);
const todoListItemVtrees$ = Collection.pluck(todoListItems$, item => item.DOM);
const sinks = {
DOM: todoListItemVtrees$.map(vtrees =>
div('.todo-list', [
button('.add-todo', 'Add todo'),
div('.items', vtrees)
])
)
}
return sinks;
}
However, it looks to me as if we are taking all the clicks and mapping them to null, leaving nothing else in the addTodo$
stream (i.e., nothing useful). Furthermore, all the events should still be in the sources
stream, so I don't see how this would be useful, or at least I don't understand how it works as a filter as claimed.