码迷,mamicode.com
首页 > 其他好文 > 详细

[Backbone]Make Backbone Better With Extensions

时间:2014-08-17 08:08:01      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:js   javascript   backbone   backbone.js   

Backbone is becoming wildly popular as a web application development framework. Along with this popularity comes countless extensions and plugins to enhance the power of the framework, and fill in holes that other felt needed filling. Let‘s take a look at some of the best choices.

Backbone.Marionette

Developed by Derick Bailey, this extension is quite large and is my personal favorite. Rather than adding one or two features to Backbone, Derick decided to fill in all the biggest holes that he felt existed. Here‘s what he says about it in the readme file of theGitHub project.

"Backbone.Marionette is a composite application library for Backbone.js that aims to simplify the construction of large scale JavaScript applications. It is a collection of common design and implementation patterns found in the applications that I (Derick Bailey) have been building with Backbone, and includes various pieces inspired by composite application architectures, such as Microsoft‘s "Prism" framework."

Let‘s take a closer look at what Marionette provides us with:

  • Application: This is a central object that everything in your application can communicate through. It offers a way to set up the main view(s) of your application quickly and easily, a central event hub that every module in your application can communicate through so they aren‘t dependent on one another, and initializers for fine-grained control of how your application boots up.
  • Modules: A means of encapsulating module code and namespacing those modules on the central application object.
  • Views: New view classes to extend that offer native methods for cleaning up, so you don‘t end up with memory leaks. It also contains rendering boilerplate; for simple views, simply specify the template and model, and it‘ll handle the rest.
  • Collection/Composite Views: This is where the "composite application library" bit comes into play. These two views allow you to easily create views that can handle the process of rendering all the views in a collection, or even a nested hierarchy of collections and models, with very little effort.
  • Regions and Layouts: A region is a object that can handle all the work of rendering, unrendering, and closing views for a particular place in the DOM. A Layout is simply a normal view that also has regions built into it for handling subviews.
  • AppRouter: A new type of router that can take a controller to handle the workload so that the router can just contain the configuration of the routes.
  • Events: Extended from the Wreqr project, Marionette makes Backbone‘s events even more powerful for creating large-scale event-based applications.

[Backbone]Make Backbone Better With Extensions,布布扣,bubuko.com

[Backbone]Make Backbone Better With Extensions

标签:js   javascript   backbone   backbone.js   

原文地址:http://blog.csdn.net/wonderfan/article/details/38635191

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!