Skip to content

Commit 00afdfc

Browse files
committed
work with new api
1 parent 0dfcb80 commit 00afdfc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/worker.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
Type,
1414
CreateDataProperty,
1515
OrdinaryObjectCreate,
16+
CreateBuiltinFunction,
1617

1718
AbruptCompletion,
1819
Throw,
@@ -55,7 +56,7 @@ addEventListener('message', ({ data }) => {
5556
});
5657

5758
realm.scope(() => {
58-
const print = new Value((args) => {
59+
const print = CreateBuiltinFunction((args) => {
5960
postMessage({
6061
type: 'console',
6162
value: {
@@ -64,12 +65,12 @@ addEventListener('message', ({ data }) => {
6465
},
6566
});
6667
return Value.undefined;
67-
});
68-
CreateDataProperty(realm.GlobalObject, new Value('print'), print);
68+
}, 1, Value('print'), []);
69+
CreateDataProperty(realm.GlobalObject, Value('print'), print);
6970

7071
{
7172
const console = OrdinaryObjectCreate(agent.intrinsic('%Object.prototype%'));
72-
CreateDataProperty(realm.GlobalObject, new Value('console'), console);
73+
CreateDataProperty(realm.GlobalObject, Value('console'), console);
7374

7475
[
7576
'log',
@@ -78,7 +79,7 @@ addEventListener('message', ({ data }) => {
7879
'error',
7980
'clear',
8081
].forEach((method) => {
81-
const fn = new Value((args) => {
82+
const fn = CreateBuiltinFunction((args) => {
8283
postMessage({
8384
type: 'console',
8485
value: {
@@ -92,8 +93,8 @@ addEventListener('message', ({ data }) => {
9293
},
9394
});
9495
return Value.undefined;
95-
});
96-
CreateDataProperty(console, new Value(method), fn);
96+
}, 1, Value(''), null);
97+
CreateDataProperty(console, Value(method), fn);
9798
});
9899
}
99100

0 commit comments

Comments
 (0)