-
Notifications
You must be signed in to change notification settings - Fork 643
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
Support for structuredClone #684
Comments
structuredClone isn’t part of the language; but it may be in the medium term. Currently, it’s a web api, so I’m not sure it makes sense for Hermes to have it. |
I think one way to look at this is, is it provided by the engine or the browser? For example, is it available in Node? |
node does not provide it currently. If they did, it'd be like setTimeout, where they're mirroring the browser without a spec compelling them to do so. |
Hey guys, In node v17 it is already present, doesn't it make sense to have it in Hermes too? |
structuredClone is now supported in the facebook/jest and facebook/lexical repository. |
I'd love to see this in react-native. |
Note that in each case People commonly confuse the browser with the engine itself. This has been a common topic in several issues submitted here, where users are requesting APIs that are not part of the EcmaScript spec. I have suggested that it might make sense to create community "integration" repository for such extensions, but there has been no interest. With all that said, admittedly, an implementation of Since Hermes will have a stable release schedule starting with the next release, it might make sense to allow external users of internal APIs, and a way to package and distribute them conveniently. In this way it would be possible to maintain efficient Hermes-specific extensions, with some cost per-release, without making them part of Hermes itself. |
FYI #1072 |
Problem
To deep clone an object today, one can either use
JSON.stringify
orlodash.cloneDeep
. There is no dedicated way of creating a deep copy in an efficient manner.Solution
A solution could be implementing:
structuredClone
(see https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)The text was updated successfully, but these errors were encountered: