◐ Shell
clean mode source ↗

doc: fix module customization hook examples · nodejs/node@e0d213d

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),