bw-vm
bw-vm
is a view manager. It's main purpose is to bring in and take out views/sections.
bw-vm
has no ties to the browser and so can be used in environments that have no ties to the browser.
For instance you could use it in a command line application or cocoonjs.
Views/sections are objects which may have the functions init
, resize
, aniIn
, aniOut
, destroy
defined.
bw-vm
will call those functions in sequence init
, resize
, aniIn
, aniOut
, destroy
. aniOut
and destroy
will not be called until the next view/section comes in.
Usage
Example
var viewmanager = ; var optionalDataYouCanPass = someData: './someImage.jpg' ; var {}; var section1 = ; // section 1 will be the initial viewvar section2 = ; // section 2 will be the second view viewmanager;viewmanager; // will take out the first section and bring in the second {}; Sectionprototype = { // data == optionalCallbackForWhenSectionIsIn ; // call done to ensure the viewmanager knows initialization is done } { // there is a function on the view manager which can be called to resize // current section it's holding. // by default 980x570 is passed } { // data == optionalCallbackForWhenSectionIsIn ; // call done to ensure the viewmanager knows animate in is done } { // data == is the data used to bring in the next section ; // call done to ensure the viewmanager knows animate out is done } { // data == is the data used to bring in the next section ; // call done to ensure the viewmanager knows when destrou is done };
License
MIT, see LICENSE.md for details.