0.0.8 • Published 10 years ago

backbone.base v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Backbone.base

Backbone.base is a collection of helper classes and common logic useful when developing backbone applications. Specifically, this project contains:

  • BaseView

  • BaseModel

How to use it

Install the library via NPM (you'll need browserify or wrapup in order to compile the final JS for the browser in your build process):

npm install backbone.base

Simply require backbone.base into your files. you'll get an aggregate object containing:

Using Backbone.base.View

The view class exported by backbone.base will give you automatic subview lifecycle management. The view class automatically listen to changes in the model and renders; When instanced, the class can be provided with a 'model' or 'collection' attribute and will render (and listen for changes) accordingly; if both 'model' and 'collection' properties are provided, the view will listen for both of them. The class exports also the following 'hooks' functions:

  • serialize() : json

  • augmentViewModel(json) : json

The base view class provides also a few useful functions:

  • renderSubviews

  • setSubview(name, selector, view)

  • getSubview(name)

  • storeSubview(name, view)

lifecycle functions

The following hooks are automatically called if defined in your view extending Backbone.base.View :

  • beforeRender
  • afterRender

Internal functions not normally used by the developer (but still available if necessary) are:

  • cleanSubview(name)

  • cleanSubviews

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago