Skip to content

Commit

Permalink
doc: fix globalPreload example
Browse files Browse the repository at this point in the history
Fixes: nodejs/node#50279
PR-URL: nodejs/node#50300
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
sercher committed Apr 25, 2024
1 parent 2208b07 commit f7148ec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions graal-nodejs/doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -976,14 +976,14 @@ close normally.
* and sends the message back to the application context
*/
export function globalPreload({ port }) {
port.onmessage = (evt) => {
port.postMessage(evt.data);
};
port.on('message', (msg) => {
port.postMessage(msg);
});
return `\
port.postMessage('console.log("I went to the Loader and back");');
port.onmessage = (evt) => {
eval(evt.data);
};
port.on('message', (data) => {
eval(data);
});
`;
}
```
Expand Down

0 comments on commit f7148ec

Please sign in to comment.