4 ms·
structuredClone is a standard library implementation of the structured clone algorithm, which was originally mainly designed for passing data between realms (eg
by eyelidlessness 3y ago
structuredClone is a standard library implementation of the structured clone algorithm, which was originally mainly designed for passing data between realms (eg between threads). Prototype chains are not preserved across realms, so it makes sense that the algorithm wouldn’t either. The accommodation for native/host types is possible because they’re implemented in each realm by the runtime, but user-defined classes don’t have that benefit.