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 = require( 'bw-vm' )();
var optionalDataYouCanPass = {
someData: './someImage.jpg'
};
var optionalCallbackForWhenSectionIsIn = function() {};
var section1 = new Section();
var section2 = new Section();
viewmanager.show( section1, optionalDataYouCanPass, optionalCallbackForWhenSectionIsIn );
viewmanager.show( section2 );
function Section() {};
Section.prototype = {
init: function( data, done ) {
done();
},
resize: function( width, height ) {
},
aniIn: function( data, done ) {
done();
},
aniOut: function( data, done ) {
done();
},
destroy: function( data, done ) {
done();
}
};
License
MIT, see LICENSE.md for details.