Skip to content

Commit

Permalink
Update README for Reflect.canBeShared
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Sep 27, 2024
1 parent 34ca5f2 commit 61a03b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ sharedBox.x = 42; // x is declared and rhs is primitive
sharedBox.x = sharedBox2; // x is declared and rhs is shared
assertThrows(() => { sharedBox.x = {}; }) // rhs is not a shared struct

// can programmatically test if a value can be shared
assert(Reflect.canBeShared(sharedBox2));
assert(!Reflect.canBeShared({}));

let worker = new Worker('worker.js');
worker.postMessage({ sharedBox });

Expand Down

0 comments on commit 61a03b4

Please sign in to comment.