Open renatoargh opened 10 years ago
Hi @renatoargh, thanks for the note.
Are you sure this is a mistake? Backbone.DeepModel
is defined as a Backbone.Model.extend()
result, meaning it "is-a" Backbone.Model constructor and that result can be called with new
up with a set of attributes in its constructor.
Backbone.DeepModel.extend()
, on the other hand, creates a new model type (which "is-a" Backbone.DeepModel and "is-a" Backbone.Model transitively). That expression also returns a constructor.
Calling new
on a call to extend
feels very weird here. Are you quite sure that's the correct way to go? (JS will parse that as new (Backbone.DeepModel.extend)(/* params */)
, I think, and if it works, it only works through pure luck.
Related: Some people forget that you can in fact directly create a Backbone.Model:
var myModel = new Backbone.Model({ attr1: "attr1" });
@platinumazure to be honest its been a long time since I had this problem by following the example so I can't really remember the context. I think that JS would parse my correction like this (but if not, thats what I should have written instead);
var Model = Backbone.DeepModel.extend({firstName:'Bob', ...
new Model();
Thanks for your answer, these plugins are both absolute awesomeness :)
Hey!!! First; thank you for your awesome work, second; it seems that this line has a minor mistake:
Actual:
With correction:
Thanks again!