Backbone with modifications. Adds heirarchy to Views, turns Views into Finite State Machines, adds a mixin for decorating methods and adds utility functions to Models and Collections.
npm install bamjs
|13||downloads in the last month|
|Version||0.7.3 last updated 3 months ago|
|Keywords||backbone, fsm, finite, state, machine, heirachy, heirachical, view, mvc, decorators|
Bam is a library intended to aid in the development of webapps. It uses Backbone as a base for its classes, adding methods and classes for common tasks.
There are two core ideas to Bam; firstly that views for a webapp can be arranged in a tree-like data structure and secondly that views are finite state machines.
Each Model, Collection and View inherits everything from Backbone's Model, Collection and View.
A Bam View is a tree and, separately, a finite state machine. The tree helps with the hierarchy of components, and the finite state machine helps with transferring user interactions and data changes into interface actions.
Models have everything a Backbone Model has, with a couple of utility functions for accessing models before and after them in a collection.
If the model is in a collection, this will return the model at the index directly after the index of this model. I.e., if you are the 2nd model in a collection it will return the third.
If the model is not in a collection it will return
null. If the model is the last model in a collection it will also return
prev() works the same as
next(). The difference it just moves the reverse direction. If the model is the first in a collection then
prev() will return
Collections have everything a Backbone Collection has, with a couple of utility functions for getting the models before and after other models in the collection.
Gets the model before the model
model in the collection. Ideally used in a collection with a comparator so there is some kind of sort order.
null if the model doesn't exist in the collection or if the model is the first in the collection.
before(model) but looks for the model afterwards.
null if the model doesn't exist in the collection or if the model is the last in the collection.
Adding to the page
- BAM! logo
- Change from