- Backbone.js Patterns and Best Practices
- Swarnendu De
- 279字
- 2021-07-19 18:28:20
Basic components of Backbone.js
We will look into some basic concepts of Backbone.js and Underscore.js before moving to the plugin development section. Backbone.js is a client-side MV* framework that provides a set of tools and building blocks required to structure a JavaScript application. Important tools that Backbone.js offers are as follows:
Backbone.Model
: Models are the entity of an application that store data and contain some logic around data such as validation, conversion, and data interaction.Backbone.View
: Views present an idea of organizing your Document Object Model (DOM) interface into logical blocks, and represent the model and collection data in them. Views are excellent tools to organize all the JavaScript event handlers and to add dynamic HTML content in your application via optional use of JavaScript templates. As Backbone follows an MV* pattern, Backbone views mostly work as presenters and take care of the major portion of application functionality.Backbone.Collection
: A collection is a group of models. A collection includes a lot of functionality as well as Underscore utility methods to help you work on multiple data models.Backbone.Router
: A router provides methods for routing client-side pages and acts subsequently whenever there is a change in the browser's URL. A router maintains the application state as per the URL change.Backbone.Events
: Events are an important concept in Backbone, since they provide a mechanism to use the PubSub pattern and decouple your application components.
Apart from these, there are other tools such as Backbone.History
, which manages the browser history and the back/forward buttons in accordance with the routers. Also, we have Backbone.Sync
, which is a single method that provides a nice abstraction to the network access through Backbone models and collections.
推薦閱讀
- Power Up Your PowToon Studio Project
- Oracle從新手到高手
- Elasticsearch for Hadoop
- Highcharts Cookbook
- C# 8.0核心技術指南(原書第8版)
- Swift Playgrounds少兒趣編程
- PHP+Ajax+jQuery網站開發項目式教程
- Xcode 6 Essentials
- 編程改變生活:用Python提升你的能力(進階篇·微課視頻版)
- ASP.NET 4.0 Web程序設計
- Hands-On Dependency Injection in Go
- Mastering OpenStack
- Python Penetration Testing Essentials
- Android開發權威指南(第二版)
- Serverless從入門到進階:架構、原理與實踐