Backbone.sync = function(method, model) {
document.write("The state of the model is:");
document.write("<br>");
//The 'method' specifies state of the model
document.write(method + ": " + JSON.stringify(model));
};
//The 'myval' is collection instance and contains the values which are to be fetched in the collection
var songs = new Backbone.Collection({
name:"Song One",
});
//The myval.fetch() method display the model's state by delegating the sync() method
songs.fetch();
Backbone.sync = function(method, model) {
return method;
};
var person = new Backbone.Model ({
Country:"Venus",
Name:"Mister Vensusresident"
});
console.log(person.fetch());
/*sync() can be thought of as what to do with the data when we call fetch()*/