Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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....

like image 212
TIMEX Avatar asked Dec 07 '11 07:12

TIMEX


People also ask

How do you trigger an event in the backbone?

Backbone. js trigger Event is used to invoke or callback the function for the given event or a space-delimited list of events. The subsequent arguments will be passed along to the event callbacks in order to trigger it.

What is backbone JS give its features?

Backbone. js allows developers to develop one page applications and front-end much easier and better using JavaScript functions. Backbone provides different types of building blocks like models, views, events, routers and collections for assembling client side web applications.

How does Backbone JS work?

BackboneJS is a lightweight JavaScript library that allows to develop and structure the client side applications that run in a web browser. It offers MVC framework which abstracts data into models, DOM into views and bind these two using events.


1 Answers

It is a bit hidden in the FAQ.

  • "add" (model, collection) — when a model is added to a collection.
  • "remove" (model, collection) — when a model is removed from a collection.
  • "reset" (collection) — when the collection's entire contents have been replaced.
  • "change" (model, collection) — when a model's attributes have changed.
  • "change:[attribute]" (model, collection) — when a specific attribute has been updated.
  • "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.
  • "route:[name]" (router) — when one of a router's routes has matched.
  • "all" — this special event fires for any triggered event, passing the event name as the first argument.
like image 135
Thilo Avatar answered Nov 15 '22 19:11

Thilo