Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 22x 22x 22x 22x 22x 22x 22x 22x 16x 16x 16x 16x 16x 16x 16x 16x 16x 22x 22x 22x 22x | 'use strict';
const {
MessageChannel,
receiveMessageOnPort,
} = require('internal/worker/io');
let channel;
function structuredClone(value, options = undefined) {
// TODO: Improve this with a more efficient solution that avoids
// instantiating a MessageChannel
channel ??= new MessageChannel();
channel.port1.unref();
channel.port2.unref();
channel.port1.postMessage(value, options?.transfer);
return receiveMessageOnPort(channel.port2).message;
}
module.exports = {
structuredClone
};
|