Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backbone.sync per model

Tags:

backbone.js

Is there a way to have a different Backbone.sync method invoked for a subset of models in an application?

I have been experimenting with binding models to socket.io, but I don't want all of them to work that way. I would like some of them to stick with REST.

Am I asking the wrong question and overriding sync is the wrong approach?

like image 916
Dennis Burton Avatar asked Jan 07 '12 19:01

Dennis Burton


People also ask

Is Backbone JS still relevant?

Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.

What is backbone JS model?

Model contains dynamic data and its logic. It performs various types of action on the data like validation, conversion, computed properties, access control etc. 1. It extends Backbone.

Is Backbone a MVC?

Backbone. js is a model view controller (MVC) Web application framework that provides structure to JavaScript-heavy applications. This is done by supplying models with custom events and key-value binding, views using declarative event handling and collections with a rich application programming interface (API).


1 Answers

var Model = Backbone.Model.extend({
  sync: function (method, model, options) {}
})
like image 61
sdfadfaasd Avatar answered Nov 09 '22 11:11

sdfadfaasd