brite.js
brite.js is a simple but powerful DOM centric MVC (D-MVC) framework for building high-end HTML5 applications.
The driving concept is to just add the missing MVC pieces to the DOM rather than force fitting Desktop MVC
and Widget patterns to the DOM. The result is simpler, easier to optimize, and more scalable HTML/CSS/JS
application code. In short, brite turns the DOM (and jQuery) into a robust, efficient, and scalable MVC platform.
MIT licensed | brite.min.js | documentation | Sample App (TodoMVC) | Release Log | more dist
Quick Overview
Create a new view definition
brite.registerView("MyView",{
create: function(data,config){
return "<div>My <button>Button</button></div>";
},
postDisplay(data,config){
var view = this;
view.$el.addClass("some-state-class");
},
events: {
"click; button": function(event){
var view = this;
console.log("A button has been clicked in view " + view.id);
}
}
})
Display instances of MyView
brite.display("MyView","body");
brite.display("MyView",$("body"));
brite.display("MyView","body").done(function(myViewInstance){
console.log("This view unique instance id is: " + myViewInstance.id);
});
IMPORTANT: Remember that the concept of brite.js is not to make everything a "View" or widget, but rather to partition the User Interface into reusable composite views (that usually become brite.js views) and smaller HTML elements that should be just HTML/CSS based with their respective delegated behavior (Bootstrap is a great base for those type of components).
Component Usage
component.json
{
…
dependencies: {
"BriteSnow/brite": "*"
…
}
…
}
Release Log
Notation: "+" Addition | "-" Fix | "!" API change | "*" Important | "." minor
1.1.2 (March 22nd 2014)
-
- added brite.config.jsPath and brite.config.cssPath for configuring the location of the brite view components when using on demand loading
- . updated examples to jquery 1.11
- . minor reformating to be more jshint compliant. Updated to bootstrap 3.1.1
- . update to handlebars 1.3.0 and fix taskmanager with latest bootstrap
-
- Makes brite.js compatible with AMD and CommonJS (Thanks to Sankar Gorthi)
- . updated sample/taskmanager to point correctly to the bootstrap 3.0 and use handlebars-1.0.0
- ! remove the brite.gtx (canvas utilities) from brite (moved gtx.js to /extra)
-
- btap issue when binding only on parent, btap on child does not propagate
-
- Fix btap event to fire only once (without the use of preventDefault which would be too destructive for other event handlers)