Skip to content

Commit

Permalink
doc: fix globalPreload example
Browse files Browse the repository at this point in the history
Fixes: #50279
PR-URL: #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
bmacnaughton authored and targos committed Oct 28, 2023
1 parent 76e4d41 commit 2b30c8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 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 2b30c8b

Please sign in to comment.