BackboneJS is a lightweight JavaScript Library that allows to develop and structure client side apps that run in web browser
BackboneJS offers an MVC framework which abstracts data into models, DOM into views and binds these two using events.
BackboneJS communicate via events
BackboneJS has a soft dependency with jquery.js and hard dependency with underscore.js
Features
- BackboneJS allows development of applications and front end in a much easier way by using JS functions.
- Building Blocks -> Models,Views, Events, Routers
- Model changes it automatically update the HTML of your application
- Separating business and UI
- Backbone for project and organize code.
- It allows you to create client side web applications or mobile applications in well structured and organised format.
Steps to Downloading the UI library and Print Hello World
Step 1: Download
a) backbone.js
b) jquery.js
c) underscore.js
From its official website.
Step 2: arrange these libraries in a folder by give name as JS libraries
Step 3: Create a html file named helloworld.js
Step 4: Add relevant tags and in header or body include 3 <script></script> and add a src property and include the JS libraries to our HTML. This must follow in an order as follows jquery.js, underscore.js, backbone.js.
Step 4: Then include
var AppView=Backbone.View.extend({
el:’#container’,
initialize: function(){
this.render();
},
render:function(){
this.$el.html(“<h1>Hello World</h1>”)
}
});
var appView = new AppView();
appView.render();
In <script></script> in the body of the html.
Step 5: Run the HTML.