Reputation: 3502
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
Reputation: 14053
You can override the sync() method for the collection instead of triggering on the completion event. If that's doable, the method
parameter will tell you the type of sync required.
Upvotes: 1