method Worker.prototype.postMessageToThread
Overload 1
#Worker.prototype.postMessageToThread(threadId: number,value: any,timeout?: number,): Promise<void>Sends a value to another worker, identified by its thread ID.
Parameters #
#threadId: numberThe target thread ID. If the thread ID is invalid, a ERR_WORKER_MESSAGING_FAILED error will be thrown.
If the target thread ID is the current thread ID, a ERR_WORKER_MESSAGING_SAME_THREAD error will be thrown.
#value: anyThe value to send.
optional
#timeout: numberTime to wait for the message to be delivered in milliseconds. By default it's undefined, which means wait forever.
If the operation times out, a ERR_WORKER_MESSAGING_TIMEOUT error is thrown.
Return Type #
Promise<void>Overload 2
#Worker.prototype.postMessageToThread(): Promise<void>