SteveSanderson / knockout-projections

Knockout.js observable arrays get smarter
160 stars 40 forks source link

Defer evaluation on projected arrays #10

Open tedsteen opened 10 years ago

tedsteen commented 10 years ago

Whenever you create a projection it is evaluated immediately. Why not defer it?

After we moved over to knockout-projections the initial page load time was higher because all our filtered and mapped arrays where deferred until first usage in our implementation.

SteveSanderson commented 10 years ago

It would just be a bit more complex to implement. If it becomes a common requirement then I'd definitely consider implementing it.

tp commented 10 years ago

I was wishing for the same thing when implementing a tree structure. While there are many way to achieve lazy loading, I think having this feature in the library makes the code the cleanest.

CraigCav commented 10 years ago

:+1: This would be very useful. When performance is a key concern (as is the case when utilizing knockout-projections), it's often necessary to defer evaluation of calculated properties until they are needed.

navnitmehta commented 9 years ago

:+1: This would be very useful addition.

jrsearles commented 8 years ago

+1

It doesn't seem like you'd want the mapping functions to be called until the observable is used. I think this library could be improved by leveraging some of the features added in the last couple releases of knockout. (defer updates, pure computeds, etc)