http://www.slideshare.net/treblam/mvcbackbone
http://jiangpeng.info/?p=79
http://www.d2forum.org/2011/07/25/%E7%AC%AC%E5%85%AD%E5%B1%8Ad2%E8%AE%BA%E5%9D%9B%E4%B8%BB%E9%A2%98%E6%BC%94%E8%AE%B2%E8%A7%86%E9%A2%91%E8%B5%84%E6%96%99%EF%BC%88%E6%A5%BC%E4%B8%8B%E4%BC%9A%E5%9C%BA%EF%BC%89/
events:
- "add" (model, collection, options) — when a model is added to a collection.
- "remove" (model, collection, options) — when a model is removed from a collection.
- "reset" (collection, options) — when the collection's entire contents have been replaced.
- "sort" (collection, options) — when the collection has been re-sorted.
- "change" (model, options) — when a model's attributes have changed.
- "change:[attribute]" (model, value, options) — when a specific attribute has been updated.
- "destroy" (model, collection, options) — when a model is destroyed.
- "request" (model, xhr, options) — when a model (or collection) has started a request to the server.
- "sync" (model, resp, options) — when a model (or collection) has been successfully synced with the server.
- "error" (model, xhr, options) — when a model's save call fails on the server.
- "invalid" (model, error, options) — when a model's validation fails on the client.
- "route:[name]" (params) — Fired by the router when a specific route is matched.
- "route" (router, route, params) — Fired by history (or router) when any route has been matched.
- "all" — this special event fires for any triggered event, passing the event name as the first argument.
Collection.parse(response,options)
is called by Backbone whenever a collection's models are returned by the server, in fetch. 请求数据后整理数据到collection的model.attributes
Model:
Backbone.Model.extend(properties,classProperties)
new Model(attributes,options)
Collection:
new Collection([models],options)
add([models],options)
collection.fetch({data:xx,success:function(a,b){},error:function(a,b){}};
Router:
Backbone.history.start({pushState:true}) Backbone.history.start()
+++++++++++++++++++++++++++++++++++++
handlebars:
custom if else helper:
Handlebars.registerHelper('hasAccess',function(val, options){
var fnTrue=options.fn, fnFalse=options.inverse;
return val >5? fnTrue(): fnFalse();
});
{{#hasAccess this.access}}
You have access!
{{else}}
You do not have access
{{/hasAccess}}
++++++++++++++++++++++++++++++++++
sass:
sass,less,stylus...
http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html
http://sass-lang.com/
http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#syntax