Open matryer opened 10 years ago
... I guess the real question is; do the tests pass on all major browsers?
How is it different than create? Is it meant to let you build a resource locally before saving it?
Exactly.
var ryan = stretchr.new("people", {name: Ryan}).save({
success: function(){
alert("Ryan was created with ID " + ryan.id());
}
});
hmmmm, yeah I can see why you asked the question then, it's the same thing as new Object()
but goes against convention.
Would be nice if we could think of a nice way to do new stretchr.Resource();
to keep it consistent with js.
technically it doesn't go against conventions... lots of methods return a new object. Although I do like the new stretchr.Resource("path", data)
idea... I wonder how it would work.
Typically if you're gong to create a new object you use extend
though, how's this for picking up an old conversation with no context. I don't think the sdk supports new
now does it?
It does
var ryan = stretchr.new("people", {name: Ryan}).save({
success: function(){
alert("Ryan was created with ID " + ryan.id());
}
});
oh...hmmm, yeah I would never use that, so I'm not the audience for it. hard to say
So how would you create a new resource?
new stretchr.Resource("path", data)
is nice but not implemented right now.
I'd probably expect it to be new stretchr.Resource
I think, but the other way looks good too, just not as conventional I don't think.
Since
new
is a JavaScript keyword, will having it as a method name be a problem?If so, what should we call it?
see https://github.com/stretchr/sdk-js/blob/rewrite/src/stretchr.js#L249