-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make bindings extensible #53
Comments
After doing some looking in other frameworks and seeing the old issue in #16, and looking at how Backbone.Epoxy handles bindings. Most other frameworks use some variation of the creational design patterns to generate their bindings. I will use Backbone.Epoxy as the example because it's the closest to ampersand being based on backbone. They use Expoxy.binding as a proxy to a singleton 'bindinghandlers' that is locally scoped to Epoxy . You can globally add to the bindings with Epoxy.bindings or you can define bindings in your view. When a view is instantiated a clone of the binding singleton is made and the locally defined handlers are added to the clone. So here is my suggestion for changes: We can look at creating a singleton containing the bindings as a key function store and an API for accessing/extending them from in this project or a separate project. getBindingFunc would then be used to attempt to locate the binding in the singleton and apply the arguments passed to ampersand-dom-view to the binding function. I would also like to look at the ability to pass in additional bindings as a parameter to ampersand-dom-bindings call. This would let you pass in locally defined bindings from the view. I will add a comment about this to AmpersandJS/ampersand-view#178. |
For anybody else that's looking for a solution right now, this works well:
|
I opened this issue to discuss creating an extensible version of ampersand-dom-bindings, relating to AmpersandJS/ampersand-view#178 and #16.
The text was updated successfully, but these errors were encountered: