Skip to content

Commit 2b30c8b

Browse files
bmacnaughtontargos
authored andcommitted
doc: fix globalPreload example
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>
1 parent 76e4d41 commit 2b30c8b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/api/esm.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,14 @@ close normally.
976976
* and sends the message back to the application context
977977
*/
978978
export function globalPreload({ port }) {
979-
port.onmessage = (evt) => {
980-
port.postMessage(evt.data);
981-
};
979+
port.on('message', (msg) => {
980+
port.postMessage(msg);
981+
});
982982
return `\
983983
port.postMessage('console.log("I went to the Loader and back");');
984-
port.onmessage = (evt) => {
985-
eval(evt.data);
986-
};
984+
port.on('message', (data) => {
985+
eval(data);
986+
});
987987
`;
988988
}
989989
```

0 commit comments

Comments
 (0)