Skip to content

Commit 61a03b4

Browse files
committed
Update README for Reflect.canBeShared
1 parent 34ca5f2 commit 61a03b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ sharedBox.x = 42; // x is declared and rhs is primitive
103103
sharedBox.x = sharedBox2; // x is declared and rhs is shared
104104
assertThrows(() => { sharedBox.x = {}; }) // rhs is not a shared struct
105105

106+
// can programmatically test if a value can be shared
107+
assert(Reflect.canBeShared(sharedBox2));
108+
assert(!Reflect.canBeShared({}));
109+
106110
let worker = new Worker('worker.js');
107111
worker.postMessage({ sharedBox });
108112

0 commit comments

Comments
 (0)