mbest / knockout

My enhancements to Knockout
35 stars 4 forks source link

trigger events when processing bindings #6

Open mbest opened 12 years ago

mbest commented 12 years ago

Binding themselves can act as a sort of event handler: by creating a custom binding, you can do something when the binding manager first processes the element (init and then update) and whenever the dependencies of that binding change (update). The template binding also include custom event handlers (afterAdd, afterRender, and beforeRemove).

I propose (in addition to #3) to create some new events for Knockout. These would be koAfterInit and koAfterUpdate. koAfterInit is called right after all the binding's init functions have been set up. koAfterUpdate is called after all the binding's update functions have been called. koAfterUpdate will act differently when #1 is implemented. It will still be called after the update functions are run, but it probably won't be all of them that run. It might be nice to include which updates were run.

mbest commented 12 years ago

Code committed