Module 基礎模組

模組worker_threads

worker 基礎模組

引用方法:

1
var worker_threads = require('worker_threads');

物件

Worker

獨立線程工作對象,參見Worker

1
Worker worker_threads.Worker;

靜態屬性

isMainThread

Boolean, 查詢當前Worker是不是主執行緒

1
static readonly Boolean worker_threads.isMainThread;

parentPort

Worker, 查詢目前Worker的父線程

1
static readonly Worker worker_threads.parentPort;

workerData

Value, 查詢父線程透過Worker構造函數傳給該線程的的資料的克隆

1
static readonly Value worker_threads.workerData;