JC JC
JC JC

Reputation: 12132

Are both the 'sync' event and Backbone.sync connected in some way -- what is the difference between the two?

What is the difference between 'sync' event and Backbone.sync?

...and what are they each specifically?

Upvotes: 3

Views: 3452

Answers (1)

Brad Koch
Brad Koch

Reputation: 20307

There is no connection between the two, although they are both related to the task of syncing data to the server.

Backbone.sync implements the persistence strategy utilized by your Backbone.js app. If you need to change something about the way your data is stored, you are welcome to override the default implementation. Most people won't need to worry about this, but if you need to do this you might want to check out How to override Backbone.sync?

The sync event indicates an update to a model has been successfully synchronized with the server. Like other model events, it will bubble up to the collection as well. This happens when:

Note: Prior to v0.9.9, the sync event was not guaranteed to fire - if you declared a success callback during any one of these operations, the sync event would not be triggered.

Upvotes: 3

Related Questions