mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
802b3e7cf9
These APIs allow arbitrary, cloneable JavaScript values to be set and passed to all new Worker instances spawned from the current context. It is similar to `workerData` except that environment data is set independently of the `new Worker()` constructor, and the the value is passed automatically to all new Workers. This is a *partial* fix of https://github.com/nodejs/node/issues/30992 but does not implement a complete fix. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/37486 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
42 lines
686 B
JavaScript
42 lines
686 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
isMainThread,
|
|
SHARE_ENV,
|
|
resourceLimits,
|
|
setEnvironmentData,
|
|
getEnvironmentData,
|
|
threadId,
|
|
Worker
|
|
} = require('internal/worker');
|
|
|
|
const {
|
|
MessagePort,
|
|
MessageChannel,
|
|
moveMessagePortToContext,
|
|
receiveMessageOnPort,
|
|
BroadcastChannel,
|
|
} = require('internal/worker/io');
|
|
|
|
const {
|
|
markAsUntransferable,
|
|
} = require('internal/buffer');
|
|
|
|
module.exports = {
|
|
isMainThread,
|
|
MessagePort,
|
|
MessageChannel,
|
|
markAsUntransferable,
|
|
moveMessagePortToContext,
|
|
receiveMessageOnPort,
|
|
resourceLimits,
|
|
threadId,
|
|
SHARE_ENV,
|
|
Worker,
|
|
parentPort: null,
|
|
workerData: null,
|
|
BroadcastChannel,
|
|
setEnvironmentData,
|
|
getEnvironmentData,
|
|
};
|