davedawkins / Sutil

Lightweight front-end framework for F# / Fable. No dependencies.
https://sutil.dev
MIT License
294 stars 18 forks source link

Difference between bindElementC and bindElementCO #65

Open alfonsogarciacaro opened 1 year ago

alfonsogarciacaro commented 1 year ago

What's the difference between bindElementC and bindElementCO? Most of the code in the functions is the same except the former calls build (element(next)) while the latter uses build (element(store)).

davedawkins commented 1 year ago
let bindElementC<'T>  (store : IObservable<'T>) (element: 'T -> SutilElement) (compare : 'T -> 'T -> bool)
let bindElementCO<'T>  (store : IObservable<'T>) (element: IObservable<'T> -> SutilElement) (compare : 'T -> 'T -> bool)

It's good question. I remember starting this refactoring to allow composition elsewhere, but the CO version is still making a subscription, and then ignoring next and projecting from the store. I would need to dig a little deeper, and see if the references (K and KO) can be refactored out.