Uses of BackboneJS –
BackboneJS provides lots of features and well organized structure to manage the application and reduce the line of codes.
Backbones works with events which manage request separately and keep the code clean and organized.
There are 2 JS on which backbonejs is dependent.
Jquery.js: Less dependency
Underscore.js: Highly dependent.
BackboneJS provides a well manage and separate structure for UI and business logic with following modules.
- Http Request
1. Http Request: Every time when a user performs any action then http request is generated for http server.
2. Router: In the base of http request router decides for correct router for the view and also maintain the URL. Backbonejs can customize the user like what will be the actual URL and what will display to the users. URL rewriting is supported by backbonejs.
3. View: View is responsible to represent model data to users (how and what data will display). Model data render on view with the help of events and view communicate with users and handle all type of events like input and bind events.
4. Events: Events are the main part and can mix up with object. It is the module that can provide ability to the objects to bind with custom events and triggered on them. Events should be declared after bind.
5. Model: Model is responsible to handle data and perform manipulation on the data and also logical part. It is also called heart of application. Model gets data from server and stores data on server.
6. Collection: Collection is responsible to manage model. Collection performs manipulations on model like new model creation, changes on model and computation on multiple models in a same time.
7. Sync: It communicates between model and data source. It is the mediator between server and model or collection.
8. History: It is responsible for maintain URL history (routes) that from where we are coming and where we will go.
2. It is simple provide separation between business logic and user interface.
3. Any changes on model will automatically reflect on related view.
4. It is open source library and available free of cost with more flexibility.
5. Backbonejs can integrate with any existing application.