backbone-view-switcher
WORK IN PROGRESS
Backbone View Switcher places Backbone.js views into a container that has an #id. It can also attach a collection to a view when the view is instantiated by Backbone View Switcher. This module currently requires Browserify.
Installation
npm install backbone-view-switcher --save
- for tests:
- cd to package root
npm install
npm test
- for examples:
gulp
(will browserify every app.js in each example)- cd to each example and open in a browser or serve. (harpjs is pretty nice for this. it will always serve an index.html file in a directory)
- to remove bundle files created by browserify:
gulp clean
Usage
In general, the primary intention of this module is to help with code-repetition / boilerplate code in a Backbone.js router or parent view.
Always start with this:
var putInto = ; // call it what you want :-)
two-step process with collection (suggested use)
key benefit is reuse of putIntoMain in a Backbone Router or elsewhere
// require some depencenciesvar putIntoMain = ; var router = BackboneRouter;
one-step process with collection
;
two-step process without collection
var putIntoMain = ;;
one-step process without collection
;
two step process with null passed as collection
var putIntoMain = ;;
one-step process with null passed as a collection
;