Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0d213d

Browse files
elliotgoodrichmarco-ippolito
authored andcommitted
doc: fix module customization hook examples
When running these examples, `node` fails to return as this`MessagePort` keeps the event loop active in the main thread unlessit is `unref()`ed.Fixes:#52846PR-URL:#53637Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>Reviewed-By: Chemi Atlow <chemi@atlow.co.il>Reviewed-By: Luigi Pinca <luigipinca@gmail.com>Reviewed-By: James M Snell <jasnell@gmail.com>Reviewed-By: Moshe Atlow <moshe@atlow.co.il>Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parent2d8490f commite0d213d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎doc/api/module.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ const { port1, port2 } = new MessageChannel();
321321
port1.on('message', (msg)=> {
322322
console.log(msg);
323323
});
324+
port1.unref();
324325

325326
register('./my-hooks.mjs', {
326327
parentURL:import.meta.url,
@@ -341,6 +342,7 @@ const { port1, port2 } = new MessageChannel();
341342
port1.on('message', (msg)=> {
342343
console.log(msg);
343344
});
345+
port1.unref();
344346

345347
register('./my-hooks.mjs', {
346348
parentURL:pathToFileURL(__filename),
@@ -431,6 +433,7 @@ const { port1, port2 } = new MessageChannel();
431433
port1.on('message', (msg)=> {
432434
assert.strictEqual(msg,'increment: 2');
433435
});
436+
port1.unref();
434437

435438
register('./path-to-my-hooks.js', {
436439
parentURL:import.meta.url,
@@ -453,6 +456,7 @@ const { port1, port2 } = new MessageChannel();
453456
port1.on('message', (msg)=> {
454457
assert.strictEqual(msg,'increment: 2');
455458
});
459+
port1.unref();
456460

457461
register('./path-to-my-hooks.js', {
458462
parentURL:pathToFileURL(__filename),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp