node:worker_threads
#Import
import worker_threads from "nstdlib/worker_threads";Note
Only the API surface is available. No threads. new Worker() throws.
#Runtime support
| Where it runs | Status | Export coverage | Details |
|---|---|---|---|
| nstd | – not measured | – | No report covers this environment. |
| Browser | ❔ not tested | 100% of Node.js | It imports with the small process shim. 21/21 Node.js exports are available. No module-specific behavior test ran. |
| Node.js (host) | ⚠️ some support | 100% of Node.js | 21/21 exports. |
#Exports (21 of 21)
Each cell shows what happens when code reads an export:
- ✅ Available through every import style. A named error also counts.
- ⚠️ Available through only some import styles.
- ❔ The export exists but has no value.
- ❌ The export does not exist.
- – This environment was not measured.
| Export | Node.js | nstdlib | browser |
|---|---|---|---|
BroadcastChannel | ✅ | ✅ | ✅ |
MessageChannel | ✅ | ✅ | ✅ |
MessagePort | ✅ | ✅ | ✅ |
SHARE_ENV | ✅ | ✅ | ✅ |
Worker | ✅ | ✅ | ✅ |
getEnvironmentData | ✅ | ✅ | ✅ |
isInternalThread | ✅ | ✅ | ✅ |
isMainThread | ✅ | ✅ | ✅ |
isMarkedAsUntransferable | ✅ | ✅ | ✅ |
locks | ✅ | ✅ | ✅ |
markAsUncloneable | ✅ | ✅ | ✅ |
markAsUntransferable | ✅ | ✅ | ✅ |
moveMessagePortToContext | ✅ | ✅ | ✅ |
parentPort | ✅ | ✅ | ✅ |
postMessageToThread | ✅ | ✅ | ✅ |
receiveMessageOnPort | ✅ | ✅ | ✅ |
resourceLimits | ✅ | ✅ | ✅ |
setEnvironmentData | ✅ | ✅ | ✅ |
threadId | ✅ | ✅ | ✅ |
threadName | ✅ | ✅ | ✅ |
workerData | ✅ | ✅ | ✅ |