Closed nevf closed 10 years ago
Hi Neville,
This is strange to hear. Interestingly enough, GDB doesn't do any conversions to the object you feed it. GDB only uses the object you supply to it as a reference and not a copy. I do believe the Object.observe()
polyfill GDB uses does add some getter and setter methods, but I believe that's it. If your model was JSON stringifiable in the first place, it should remain so.
Perhaps I misunderstand your question though. If I don't understand, could you please show me a commented example of the behavior?
Thanks, -John
If you meant that you'd like GDB to convert complex models to plain JavaScript object literals, I could make a method that does this, if you'd like.
Hi John, Yes it was the setter & getter methods that had me confused. This does indeed work fine as is, however a function to get plain JS object literal would probably be worthwhile.
I may add this feature in the future, but not today. If this feature is very important to Clibu, I can consider adding it much sooner. Let me know and I'll see what I can do. Perhaps I'll add this as an additional module as to not bloat the main library too much.
GDB changes a model so it is no longer a plain Javascript object which of course it has to. However I can't see a method to convert back to a plain JS object. I'm using:
Am I missing something? If not how about adding a
plainModel( model )
function to GDB to do this.