TylorS / cycle-snabbdom

Alternative DOM driver utilizing the snabbdom library
MIT License
41 stars 5 forks source link

Observable of vtrees inside a regular vtree #16

Closed yemi closed 8 years ago

yemi commented 8 years ago

I would like to know if it's possible to add an observable of vtrees directly into a view like in the todo-mvc example: https://github.com/cyclejs/todomvc-cycle/blob/master/src/components/Todos/view.js#L29

This looks kind of magical to me and im not sure how it works, but does cycle-snabbdom support the same kind of usage?

SkaterDad commented 8 years ago

@yemi That is supported by this driver. If I recall, the function which parses the vTree flattens the observables. Can't look at the source right now to double check, but that's roughly it.

It's certainly a great feature for convenience.

SkaterDad commented 8 years ago

Here is a link to the section of code: transposition.js

If it detects an observable, it flatMaps it and recursively calls the transpose function.

TylorS commented 8 years ago

Thanks @SkaterDad for pointing him to that.

TylorS commented 8 years ago

Closing this. If anyone feels it needs to be reopened feel free.