Backbone Tutorials

Catalog of Events

Catalog of Events

Here is the whole record of built-in Backbone events, with arguments.
You are additionally free to trigger your individual events on Fashions, Collections and
Views as you see match. The Backbone object itself mixes in Events,
and can be utilized to emit any world events that your application wants.

  • “add” (model, collection, options) — when a model is added to a set.
  • “remove” (model, collection, options) — when a model is faraway from a set.
  • “replace” (collection, options) — single event triggered after any variety of models have been added, eliminated or changed in a set.
  • “reset” (collection, options) — when the gathering’s complete contents have been reset.
  • “sort” (collection, options) — when the gathering has been re-sorted.
  • “change” (model, options) — when a model’s attributes have changed.
  • “change:[attribute]” (model, value, options) — when a selected attribute has been up to date.
  • “destroy” (model, collection, options) — when a model is destroyed.
  • “request” (model_or_collection, xhr, options) — when a model or assortment has began a request to the server.
  • “sync” (model_or_collection, response, options) — when a model or assortment has been efficiently synced with the server.
  • “error” (model_or_collection, xhr, options) — when a model’s or assortment’s request to the server has failed.
  • “invalid” (model, error, options) — when a model’s validation fails on the shopper.
  • “route:[name]” (params) — Fired by the router when a selected route is matched.
  • “route” (route, params) — Fired by the router when any route has been matched.
  • “route” (router, route, params) — Fired by historical past when any route has been matched.
  • “all” — this particular occasion fires for any triggered occasion, passing the occasion title as the primary argument adopted by all trigger arguments.

Typically talking, when calling a perform that emits an occasion
(model.set, collection.add, and so on…),
if you would like to forestall the occasion from being triggered, you might go
{silent: true} as an possibility. Observe that this is hardly ever,
even perhaps by no means, a good suggestion. Passing via a selected flag
within the choices on your occasion callback to look at, and select to disregard,
will often work out higher.