简体   繁体   English

在Backbone.js中,“绑定”的所有事件是什么?

[英]In Backbone.js, what are all events for the “binds”?

Collection.bind('change',this.function, this);
Collection.bind('add',this.function, this);
Collection.bind('remove',this.function, this);
Collection.bind('reset',this.function, this);

I know these four, but what are the rest? 我知道这四个,但其余的是什么?

What about model binds? 模型绑定怎么样? What are the events for those? 这些活动有哪些?

How come I can't find a documentation specifying all the binds.... 为什么我找不到指定所有绑定的文档....

It is a bit hidden in the FAQ. 在FAQ中有点隐藏。

  • "add" (model, collection) — when a model is added to a collection. “添加” (模型,集合) - 将模型添加到集合时。
  • "remove" (model, collection) — when a model is removed from a collection. “remove” (model,collection) - 从集合中删除模型时。
  • "reset" (collection) — when the collection's entire contents have been replaced. “reset” (集合) - 当集合的全部内容被替换时。
  • "change" (model, collection) — when a model's attributes have changed. “更改” (模型,集合) - 当模型的属性发生变化时。
  • "change:[attribute]" (model, collection) — when a specific attribute has been updated. “change:[attribute]” (model,collection) - 更新特定属性时。
  • "destroy" (model, collection) — when a model is destroyed. “破坏” (模型,集合) - 模型被销毁时。
  • "error" (model, collection) — when a model's validation fails, or a save call fails on the server. “error” (model,collection) - 当模型的验证失败,或者服务器上的保存调用失败时。
  • "route:[name]" (router) — when one of a router's routes has matched. “route:[name]” (路由器) - 当路由器的其中一条路由匹配时。
  • "all" — this special event fires for any triggered event, passing the event name as the first argument. “all” - 此特殊事件触发任何触发事件,将事件名称作为第一个参数传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM