-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
observable cannot survive JSON.stringify #86
Comments
Hi @lilchow, Sorry for the long long wait. I actually opened the issue and then forgot to answer it. The described behavior is expected. Observable objects are functions and JSON.stringify skips functions when stringifying objects. In order to resolve your issue you could manually extract the values in an object and then call JSON.stringify.
|
You could also write a JSON.stringify replacer function, like so jsfiddle. @astoilkov Maybe some function like this should be integrated into jsblocks? Have a great day |
Yeah. I like that idea. I am thinking of something like |
A |
Or we implement a |
Let's say I created this simple object:
var a={};
a.obs=blocks.observable(2);
console.log(JSON.stringify(a)) would show only an empty object, i.e. "{}";
The text was updated successfully, but these errors were encountered: