gvas / knockout-jqueryui

Knockout bindings for the jQuery UI widgets.
http://gvas.github.com/knockout-jqueryui/
MIT License
103 stars 38 forks source link

Documentation on creating new bindings #11

Closed juuxstar closed 10 years ago

juuxstar commented 11 years ago

Hi gvas,

I'm incorporating a number of JQuery widgets from the plugins into my project and thought it would be great to use your bindingFactory to create bindings for them just like you did for the basic JQueryUI widgets.

I'm looking at your examples to figure this out but it would be great if you could create a simple page documenting on how one could go about creating custom bindings and all the various options that might go with it.

Thanks.

juuxstar commented 11 years ago

Specifically, if there are (or perhaps we could build) utility functions for common tasks like wiring up to events/subscriptions to update options/model values. Since you've done more of these than me, you'd be a better judge of how often a pattern repeats and what a good abstraction layer might be.

gvas commented 11 years ago

Hi juuxstar,

The binding factory strongly depends on the API style used by the jQuery UI widgets. So it's unusable for arbitrary widgets unless they leverage the jQuery UI Widget Factory.

Anyway, I think that the binding factory's code is straigthforward enough, maybe the only tricky thing is that the bindings' options are accessed in separate computeds. This ensures that they will be independent from each other, and also from the other bindings on the bound element. This keeps them fast. See rpn's blog for details.

I'd also be glad to review your custom bindings, my email address is on my github profile page.

Regards, Gábor