Light weight dependency injection for client side components. Looks for
all DOM elements with a data-bindable attribute, stores references
within a registry and instantiates their respective classes.
- Cleanup docs and describe a little more behind bindable (i.e. local bindables, etc.)
- Link to Jed's presentation
- Wrap more tests around bindable's setup
- Create packages for Bower and Component
Describe this
As a class making use of the Bindable registry:
varToggleGroup=(function(){functionToggleGroup(el){this.el=el}ToggleGroup.prototype.dispose=function(){// Clean up your mess};returnToggleGroup})();Bindable.register('toggle-group',ToggleGroup);As markup instantiating a class that is registered with Bindable:
<navdata-bindable="toggle-group">...</nav>Bindable is created after the page has loaded
varbindablewindow.addEventListener('DOMContentLoaded',function(){bindable=newBindable().bindAll()// ...});Binds all elements on the page with a data-bindable attribute with
it's respective class.
varbindable=newBindable()bindable.bindAll()TODO: Describe This!!!!
Returns a listing of all bindable objects on the page.
varbindable=newutensils.Bindable()bindable.bindAll()varbinded=bindable.getRefs()Calls the dispose method on all bindable objects and cleans out the
instance of Bindable.
varbindable=newutensils.Bindable()bindable.bindAll()bindable.dispose()Static method for returning a class instance out of the registry from a key.
varobject=Bindable.getClass('key')Manually add a bindable object to the registry by passing a key and a class instance.
Bindable.register('my_class',newMyClass())