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

structuredClone #969

Closed
zloirock opened this issue Aug 7, 2021 · 9 comments · Fixed by #984
Closed

structuredClone #969

zloirock opened this issue Aug 7, 2021 · 9 comments · Fixed by #984

Comments

@zloirock
Copy link
Owner

zloirock commented Aug 7, 2021

structuredClone method now exposed in the HTML spec. It's not a part of ECMAScript, but it's a very useful cross-platform feature, so makes sense to add it to core-js. If someone wanna contribute something significant to core-js - it's a good chance.

@BasixKOR
Copy link
Contributor

FYI, This is the algorithm used for structured clone serialization and deserialization.

And can I get a chance to implement this? Not very familar with core-js codebase but I really wanna give it a try :)

@zloirock
Copy link
Owner Author

@BasixKOR sure. Ask me if you will have any questions.

@zloirock zloirock mentioned this issue Sep 14, 2021
27 tasks
@petamoriken
Copy link
Contributor

I made a list of Serializables and Transferables from WebIDL. I hope this helps :)

https://gist.github.com/petamoriken/3802602b8e93d89e5b4c21e36683cadb#gistcomment-3899514

@petamoriken
Copy link
Contributor

The next release of Node.js (v17.0.0) will include structuredClone and DOMException.
nodejs/node#40119

I think it would be nice to add support for DOMException.
related: #938

@zloirock
Copy link
Owner Author

@petamoriken thanks! However, I'm not sure that the implementation of the transferable behavior is possible in most cases.

@BasixKOR
Copy link
Contributor

BasixKOR commented Sep 27, 2021

The ongoing implementation of structuredClone uses DOMException if it's available, and fallbacks to plain Error if there isn't. I guess the support table should be updated to reflect the support status of Deno and Node.js.

And yeah as @zloirock pointed out the transferable behaviour cannot be cleanly implemented as a polyfill, so it won't have transfer argument support for now. Any suggestion for implementing it is welcome though!

@zloirock
Copy link
Owner Author

tc39/ecma262#2555

@zloirock
Copy link
Owner Author

zloirock commented Oct 29, 2021

FF implementation can't clone errors, https://bugzilla.mozilla.org/show_bug.cgi?id=1556604.

@zloirock
Copy link
Owner Author

zloirock commented Nov 4, 2021

whatwg/html#5749

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

Successfully merging a pull request may close this issue.

3 participants