The BackboneJS gives a structure to the web applications that allows to separate business logic and user interface logic. Open this in your browser and the screen will show the following text. This will print the "Hello TutorialsPoint" in the div with id = "container" In the last line, we are initializing new AppView(). Every view has an element associated with HTML content, There's a html code at the start of body tag This.$el.html("Hello TutorialsPoint!!!") Like the Hello TutorialsPoint in this case. $el - it's a cached jQuery object (el), in which you can use jQuery functions to push content. It's the first function called when this view is instantiated. Every view has an element associated with HTML content, will be rendered. Let's create a simple example using BackboneJS. Note − We are using the CDN versions of the library throughout this tutorial. Hence CDN for all the above is as follows − This also offers an advantage that if the visitor to your webpage has already downloaded a copy of BackboneJS from the same CDN, it won't have to be re-downloaded.Īs said above, BackboneJS has a dependency of the following JavaScript − If you use a CDN link in your web page, it moves the responsibility of hosting files from your own servers to a series of external ones. You can get it from here.Ī CDN or Content Delivery Network is a network of servers designed to serve files to users. Json2.js − Include this file for older Internet Explorer support. JQuery.js − Include this file for RESTful persistence, history support via Backbone.Router and DOM manipulation with Backbone.View. Underscore.js − This is the only hard dependency which needs to be included. Production Version − Right click on this button and save as and you get the Backbone-min.js library file which is packed and gzipped.Įdge Version − Right click on this button and save as and you get an unreleased version, i.e., development is going on hence you need to use it at your own risk.īackboneJS depends on the following JavaScript files − When you open the link, you will get to see a screenshot as shown below −Īs you can see, there are three options for download of this library −ĭevelopment Version − Right click on this button and save as and you get the full source JavaScript library. Downloading UI library from its official website.ĭownloading the UI library from its official website.This chapter will discuss the download and setup of the BackboneJS Library.īackboneJS can be used in the following two ways − It allows to create client side web applications or mobile applications in a wellstructured and an organized format.īackboneJS is very easy to setup and work. It manages the data model which includes the user data and displays that data at the server side with the same format written at the client side.īackboneJS has a soft dependency with jQuery and a hard dependency with Underscore.js. It acts like a backbone for your project and helps to organize your code. It is free and open source library and contains over 100 available extensions. When a model changes, it automatically updates the HTML of your application.īackboneJS is a simple library that helps in separating business and user interface logic. The following are a list of features of BackboneJS −īackboneJS allows developing of applications and the frontend in a much easier way by using JavaScript functions.īackboneJS provides various building blocks such as models, views, events, routers and collections for assembling the client side web applications. Your code will be cleaner, nicer and easy to maintain. If you want a better design with less code, then it is better to use the BackboneJS library that provides good functionality, is well organized and in a structured manner for developing your application.īackboneJS communicates via events this ensures that you do not mess up the application. Then your application might become complicated. In this application, if you −Īdd or replace DOM elements to the application or When to use BackboneĬonsider you are creating an application with numerous lines of code using JavaScript or jQuery. History − BackboneJS was developed by Jeremy Ashkenas and was initially released on October 13 th, 2010. It offers MVC framework which abstracts data into models, DOM into views and bind these two using events. BackboneJS is a lightweight JavaScript library that allows to develop and structure the client side applications that run in a web browser.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |