Skip to content

Commit

Permalink
lib: make structuredClone spec compliant
Browse files Browse the repository at this point in the history
Fixes: #40246
  • Loading branch information
VoltrexKeyva committed Sep 29, 2021
1 parent 481c160 commit ab4fd2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/structured_clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const {
} = require('internal/worker/io');

let channel;
function structuredClone(value, transfer) {
function structuredClone(value, options) {
// 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, transfer);
channel.port1.postMessage(value, options?.transfer);
return receiveMessageOnPort(channel.port2).message;
}

Expand Down

0 comments on commit ab4fd2b

Please sign in to comment.