I have a model, which is fetched from the server. I would like to return a promise on creation, so that views that are using this model know, when to render. I could bind the promise to the window (or app), but a neater way would be to just return it, when the model is initialized (var promise = new app.User()). Is there a way to do this. And also: Is this a good way of handling async data?
app.User = Backbone.Model.extend({
urlRoot: baseUrl+"/user",
initialize: function(){
this.promise = this.fetch();
return this.promise; // Doesn't work ofc
}
});