titel
titel

Reputation: 3502

What was the nature of the Backbone collection sync event?

If one set's a event listeners on a Backbone collection's sync event, how can it be determined from the event listener what the nature of the sync was: was it an updated? a new model was added to the collection or was actually deleted?

At the fist glance the information about the completed xhr request that is being returned to the listener does not contain the HTTP method used with that sync (get, put, post or delete).

Upvotes: 0

Views: 66

Answers (1)

Stephen Thomas
Stephen Thomas

Reputation: 14053

You can override the sync() method for the collection instead of triggering on the completion event. If that's doable, the methodparameter will tell you the type of sync required.

Upvotes: 1

Related Questions