worker: use kEmptyObject

PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
LiviaMedeiros authored and Michaël Zasso committed 2022-07-31 09:44:30 +02:00
1 parent 4ff19daf54
commit 51633a23c7
2 files changed
+7 -3

No files matched your search

+2 -1
View File
@@ -55,6 +55,7 @@ const {
} = workerIo;
const { deserializeError } = require('internal/error_serdes');
const { fileURLToPath, isURLInstance, pathToFileURL } = require('internal/url');
const { kEmptyObject } = require('internal/util');
const { validateArray } = require('internal/validators');
const {
@@ -118,7 +119,7 @@ function assignEnvironmentData(data) {
}
class Worker extends EventEmitter {
constructor(filename, options = {}) {
constructor(filename, options = kEmptyObject) {
super();
debug(`[${threadId}] create new worker`, filename, options);
if (options.execArgv)
+5 -2
View File
@@ -18,7 +18,10 @@ const {
SymbolFor,
} = primordials;
const { kEnumerableProperty } = require('internal/util');
const {
kEmptyObject,
kEnumerableProperty,
} = require('internal/util');
const {
handle_onclose: handleOnCloseSymbol,
@@ -123,7 +126,7 @@ class MessageEvent extends Event {
lastEventId = '',
source = null,
ports = [],
} = {}) {
} = kEmptyObject) {
super(type);
this[kData] = data;
this[kOrigin] = `${origin}`;