Skip to content

Commit

Permalink
doc: fix globalPreload example
Browse files Browse the repository at this point in the history
Fixes: #50279
  • Loading branch information
bmacnaughton authored and aduh95 committed Oct 20, 2023
1 parent a0e60c1 commit 0b149f6
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 0b149f6

Please sign in to comment.