Backbone.js framework with abstract classes
git clone --depth 1 https://github.com/tbranyen/backbone-boilerplate
Running automated test
Backbone.AbstractModel.md provides generic functionality shared by all the models.
In particular it automatically merges a supplied options hash into
this.options. It also binds object properties to
this.set methods. So in a subtype of
Backbone.AbstractModel you can access/mutate
attributes of a model directly (e.g.
model.email = "firstname.lastname@example.org";).
Backbone.AbstractView.md provides generic functionality shared by all the views.
The same as
Backbone.AbstractModel it automatically merges a supplied options hash into
this.find method to deal with 'future' nodes and extends
this.listenTo for better usage experience.
Backbone.AbstractForm.md abstracts form-related functionality Form View performs the following tasks:
- validates form while typing (on-fly)
- validates form while typing against server (when
- validates form on submit
- invokes handlers
state-changedevent when form validity state changes
- toggles CSS classes
is-visitedon the form and inputs in accordance with object validity
- processes form directives
Backbone.JST.md is template namespace that populates automatically from the embedded scripts
Backbone.utils.md extends Exoskeleton
What we can do is to go with
Exoskeleton - Backbone's fork decoupled from Underscore. Further by means of
Backbone.NativeView/Backbone.Fetch we get rid of jQuery too. The formula is:
Exoskeleton + Backbone.NativeView +
Fetch API polyfill
The whole bundle concatenated and minimized can be found
Communication Between Modules
Modules like View can be dynamically created and removed and direct references can be be broken besides the fact of tight coupling.
I suggest to encapsulate communication between modules in a mediator implementing PubSub interface.
Here I extend
Backbone.Events (Router/app). Thus we can trigger and
subscribe for the type instance as well as for Router events across the application modules.
Backbone.Abstract includes following polyfills:
Array.from- to convert a collection to an array