首页IT科技backbone(Backbone.js)

backbone(Backbone.js)

时间2025-06-20 15:38:09分类IT科技浏览5102
导读:Backbone.js gives structure to web applications by providing...

Backbone.js gives structure to web applications

by providing models

with key-value binding and custom events,

collections

with a rich API of enumerable functions,

views

with declarative event handling, and connects it all to your

existing API over a RESTful JSON interface.

The project is hosted on GitHub,

and the annotated source code is available,

as well as an online test suite,

an example application,

a list of tutorials

and a long list of real-world projects that use Backbone.

Backbone is available for use under the MIT software license.

You can report bugs and discuss features on the

GitHub issues page,

on Freenode IRC in the #documentcloud channel, post questions to the

Google Group,

add pages to the wiki

or send tweets to @documentcloud.

Backbone is an open-source component of

DocumentCloud.

Downloads & Dependencies

(Right-click, and use "Save As")

Development Version (0.9.2) 52kb, Full source, lots of comments Production Version (0.9.2) 5.6kb, Packed and gzipped

Backbones only hard dependency is

Underscore.js ( > 1.3.1).

For RESTful persistence, history support via Backbone.Router

and DOM manipulation with Backbone.View, include

json2.js, and either

jQuery ( > 1.4.2) or

Zepto.

Introduction

When working on a web application that involves a lot of JavaScript, one

of the first things you learn is to stop tying your data to the DOM. Its all

too easy to create JavaScript applications that end up as tangled piles of

jQuery selectors and callbacks, all trying frantically to keep data in

sync between the HTML UI, your JavaScript logic, and the database on your

server. For rich client-side applications, a more structured approach

is often helpful.

With Backbone, you represent your data as

Models, which can be created, validated, destroyed,

and saved to the server. Whenever a UI action causes an attribute of

a model to change, the model triggers a "change" event; all

the Views that display the models state can be notified of the

change, so that they are able to respond accordingly, re-rendering themselves with

the new information. In a finished Backbone app, you dont have to write the glue

code that looks into the DOM to find an element with a specific id,

and update the HTML manually

— when the model changes, the views simply update themselves.

If youre new here, and arent yet quite sure what Backbone is for, start by

browsing the list of Backbone-based projects.

Many of the examples that follow are runnable. Click the play button

to execute them.

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
nodejs菜鸟教程(Node.js Manual)