It seems like the OP's intent is just to deep-copy an object. Something
like the OP's tweet... or this, which we use in some tests:
function structuredClone(o) {
return new Promise(function(resolve) {
var mc = new MessageChannel();
mc.port2.onmessage = function(e) { resolve(e.data); };
mc.port1.postMessage(o);
});
}
... but synchronous, which is fine, since the implicit
serialization/deserialization needs to be synchronous anyway.
If we're not dragging in the notion of extensibility, is there
complication? I'm pretty sure this would be about a two line function in
Blink. That said, without being able to extend it, is it really interesting
to developers?
On Fri, Apr 24, 2015 at 2:05 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Fri, Apr 24, 2015 at 2:08 AM, Robin Berjon <robin@w3.org> wrote:
> > Does this have to be any more complicated than adding a toClone()
> convention
> > matching the ones we already have?
>
> Yes, much more complicated. This does not work at all. You need
> something to serialize the object so you can transport it to another
> (isolated) global.
>
>
> --
> https://annevankesteren.nl/
>
>