mbest / knockout-deferred-updates

Deferred Updates plugin for Knockout <=3.3.0
http://mbest.github.io/knockout-deferred-updates/
134 stars 23 forks source link

Use `after` on update for bindings which are deferred together. #26

Closed DrSammyD closed 9 years ago

DrSammyD commented 9 years ago

I don't know if it's necessary, nor if it's useful. I just wanted to point out that you could potentially add this functionality to deferred updates, and that I think it would intuitively work in this manner.

Here's a jsfiddle to illustrate that the second will fire before the first, even though it's marked as after the first.

I created this fiddle just to see if it worked in that manner. If you open the debugger, a debugger point will be hit. If you then Shift + F11 up the stack, before you reach the top, you'll hit another. So both of them are run in the same stack.

Again, likely not an issue for anybody. Just wanted to share this insight into the inner workings of knockout.

mbest commented 9 years ago

The after flag only controls the order that the bindings initialized. After that, the two bindings are generally updated independently.

DrSammyD commented 9 years ago

Indeed. and that makes sense with knockout sans deferred updates as it would be impossible to do when notifySubscribers happens synchronously. However your plugin makes it possible, and I just wanted to point that out.

mbest commented 9 years ago

No problem. It's an interesting idea.