Skip to content

Commit 44b65d0

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
worker: use kEmptyObject
PR-URL: #43159 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 7fc432f commit 44b65d0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/internal/worker.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const {
5555
} = workerIo;
5656
const { deserializeError } = require('internal/error_serdes');
5757
const { fileURLToPath, isURLInstance, pathToFileURL } = require('internal/url');
58+
const { kEmptyObject } = require('internal/util');
5859
const { validateArray } = require('internal/validators');
5960

6061
const {
@@ -118,7 +119,7 @@ function assignEnvironmentData(data) {
118119
}
119120

120121
class Worker extends EventEmitter {
121-
constructor(filename, options = {}) {
122+
constructor(filename, options = kEmptyObject) {
122123
super();
123124
debug(`[${threadId}] create new worker`, filename, options);
124125
if (options.execArgv)

lib/internal/worker/io.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const {
1818
SymbolFor,
1919
} = primordials;
2020

21-
const { kEnumerableProperty } = require('internal/util');
21+
const {
22+
kEmptyObject,
23+
kEnumerableProperty,
24+
} = require('internal/util');
2225

2326
const {
2427
handle_onclose: handleOnCloseSymbol,
@@ -123,7 +126,7 @@ class MessageEvent extends Event {
123126
lastEventId = '',
124127
source = null,
125128
ports = [],
126-
} = {}) {
129+
} = kEmptyObject) {
127130
super(type);
128131
this[kData] = data;
129132
this[kOrigin] = `${origin}`;

0 commit comments

Comments
 (0)