Skip to content
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

store existing JSON block? #1

Closed
swampthang opened this issue Mar 4, 2017 · 2 comments
Closed

store existing JSON block? #1

swampthang opened this issue Mar 4, 2017 · 2 comments

Comments

@swampthang
Copy link

Thank you for this awesome node module! I am most interested in using this as a tool for undo/redo. I'm implementing it in an Electron app that uses Greensock's animation platform - GSAP. In an effort to be able to undo/redo as well as have all the data necessary to save files for later use, I've had to utilize Circular JSON es6 to save the data from the timeline to JSON. I noticed in your code that the available types for a collection automatically attempt to convert to JSON...

"array": JSON.parse(JSON.stringify(val || [])),
"map": JSON.parse(JSON.stringify(val || {})),

I can't store the timelines using this because it would create a Circular issue. So, I'm using circular-json-es6 to convert to JSON safely and then want to store that. Are there any plans to add a blob type?

Thanks again!

@only-cliches
Copy link
Owner

Hello Swampthang,

Glad you're getting some use out of it!

I just released 0.3.1 which includes the blob type you requested. Keep in mind a major reason I had the JSON.parse and JSON.stringify in place was to break deep references inside objects, otherwise things like the history might not work if your past 3 history points are accidentally referencing the same internal object.

So just make sure that you're breaking any references between the objects when you do an upsert to keep the history working correctly. You might find it easier to just work with the existing Map type in the end.

Best,
Scott

@swampthang
Copy link
Author

Thanks a million, Scott! Will keep that in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants