mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
doc: fix globalPreload example
Fixes: https://github.com/nodejs/node/issues/50279 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
76e4d4117c
commit
2b30c8b8a3
1 file changed
+6
-6
+6
-6
@@ -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);
|
||||
});
|
||||
`;
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user