web javascript 框架学习

   JS 框架学习


1. Underscore      http://documentcloud.github.com/underscore/
==============================================================
Underscore is a utility-belt library for JavaScript that provides a lot of the 
functional programming support that you would expect in Prototype.js (or Ruby),
but without extending any of the built-in JavaScript objects. It's the tie to 
go along with jQuery's tux.


Table of Contents
-----------------


Object-Oriented and Functional Styles
Collections 
-----------
each, map, reduce, reduceRight, detect, select, reject, all, any, include, 
invoke, pluck, max, min, sortBy, groupBy, sortedIndex, toArray, size


Arrays 
------
first, rest, last, compact, flatten, without, union, intersection, difference,
uniq, zip, indexOf, lastIndexOf, range


Functions 
---------
bind, bindAll, memoize, delay, defer, throttle, debounce, once, after, wrap, compose


Objects 
-------
keys, values, functions, extend, defaults, clone, tap, isEqual, isEmpty, isElement,
isArray, isArguments, isFunction, isString, isNumber, isBoolean, isDate, isRegExp
isNaN, isNull, isUndefined


Utility 
-------
noConflict, identity, times, mixin, uniqueId, template


Chaining 
--------
chain, value


简单的来说,Underscore 就是一个基础工具库,对JavaScript 的一些函数,方法等进行了
封装, 用来提供函数式编程的特性, 虽然有自己的template轻量级的渲染模板,但不是很好用。




2. mustache         https://github.com/janl/mustache.js
==============================================================
Logic-less templates with JavaScript
Quik start:
->var view = {
->      title: "Joe",
->      calc: function() {
->        return 2 + 4;
->      }
->}
->var template = "{{title}} spends {{calc}}";
->var html = Mustache.to_html(template, view);




非常简洁直观的template模板渲染工具。功能强大语法简洁。好的没得说。


3. Prototype        http://prototypejs.org/
===========================================
Prototype is a JavaScript framework that aims to ease development of dynamic web
applications. It offers a familiar class-style OO framework, extensive Ajax 
support, higher-order programming constructs, and easy DOM manipulation.


这个主要包含了 Ajax相关的,扩展DOM 其中,扩展DOM是核心, 它使得DOM访问更面向对象
话,也就是说,将面向对象的更多属性集成到了js, 包括继承等。






4. Backbone         http://documentcloud.github.com/backbone/
============================================================
Backbone supplies structure to JavaScript-heavy 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 application over a RESTful JSON interface.


Events


    – bind
    – unbind
    – trigger


Model


    – extend
    – constructor / initialize
    – get
    – set
    – escape
    – has
    – unset
    – clear
    – id
    – cid
    – attributes
    – defaults
    - toJSON
    – fetch
    – save
    – destroy
    – validate
    – url
    – urlRoot
    – parse
    – clone
    – isNew
    – change
    – hasChanged
    – changedAttributes
    – previous
    – previousAttributes


Collection


    – extend
    – model
    – constructor / initialize
    – models
    – toJSON
    – Underscore Methods (26)
    – add
    – remove
    – get
    – getByCid
    – at
    – length
    – comparator
    – sort
    – pluck
    – url
    – parse
    – fetch
    – reset
    – create


Router


    – extend
    – routes
    – constructor / initialize
    – route
    – navigate


History


    – start


Sync


    – Backbone.sync
    – Backbone.emulateHTTP
    – Backbone.emulateJSON


View


    – extend
    – constructor / initialize
    – el
    – $ (jQuery or Zepto)
    – render
    – remove
    – make
    – delegateEvents


Utility


    – noConflict


简单的说,就是backbone提供了一套比较完整的在JS里边使用MVC的框架。适合大型应用,例如
WEB2.0 站点。





你可能感兴趣的:(javascript,web,underscore,constructor,prototype,collections)