| type | "classic" \| "module" | Yes | Yes | Mode in which the **Worker** instance executes the script. The default value is **classic**. The module **type** is not supported yet.|
| type | "classic" \| "module" | Yes | Yes| Mode in which the **Worker** instance executes the script. The **module** type is not supported yet. The default value is **classic**.|
| name | string | Yes | Yes | Name of the worker thread.|
| name | string | Yes | Yes| Name of the worker thread. The default value is **undefined**.|
| shared | boolean | Yes | Yes | Sharing of the **Worker** instance is not supported yet.|
| shared | boolean | Yes | Yes| Whether sharing of the **Worker** instance is enabled. Currently, sharing is not supported.|
## ThreadWorker<sup>9+</sup>
## ThreadWorker<sup>9+</sup>
...
@@ -188,8 +188,6 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
...
@@ -188,8 +188,6 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| message | Object | Yes | Message to be sent to the worker thread. |
| message | Object | Yes | Message to be sent to the worker thread. |
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The **transferList** array cannot contain **null**.|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.|
**Error codes**
**Error codes**
...
@@ -859,7 +857,7 @@ Sends a message to the host thread from the worker thread.
...
@@ -859,7 +857,7 @@ Sends a message to the host thread from the worker thread.
| message | Object | Yes | Message to be sent to the worker thread. |
| message | Object | Yes | Message to be sent to the host thread. |
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The **transferList** array cannot contain **null**.|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.|
**Error codes**
**Error codes**
...
@@ -1279,8 +1277,6 @@ Sends a message to the worker thread. The data type of the message must be seque
...
@@ -1279,8 +1277,6 @@ Sends a message to the worker thread. The data type of the message must be seque
| message | Object | Yes | Message to be sent to the worker thread. |
| message | Object | Yes | Message to be sent to the worker thread. |
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The **transferList** array cannot contain **null**.|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.|
**Example**
**Example**
...
@@ -1309,6 +1305,9 @@ Sends a message to the worker thread. The data type of the message must be seque
...
@@ -1309,6 +1305,9 @@ Sends a message to the worker thread. The data type of the message must be seque
@@ -1693,19 +1692,41 @@ Implements communication between the worker thread and the host thread. The **po
...
@@ -1693,19 +1692,41 @@ Implements communication between the worker thread and the host thread. The **po
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9) instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9) instead.
Sends a message to the host thread from the worker thread.
Sends a message to the host thread from the worker thread.
> **NOTE**
>
> The **DedicatedWorkerGlobalScope** class is deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-2).
Sends a message to the host thread from the worker thread.
Sends a message to the host thread from the worker thread.
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9).postMessage<sup>9+</sup> instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-3).
| message | Object | Yes | Message to be sent to the worker thread. |
| message | Object | Yes | Message to be sent to the host thread. |
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The **transferList** array cannot contain **null**.|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.|
**Example**
**Example**
...
@@ -1778,7 +1799,7 @@ close(): void
...
@@ -1778,7 +1799,7 @@ close(): void
Terminates the worker thread to stop it from receiving messages.
Terminates the worker thread to stop it from receiving messages.
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9).close<sup>9+</sup> instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.close<sup>9+</sup>](#close9).
Defines the event handler to be called when the worker thread receives a message sent by the host thread through **postMessage**. The event handler is executed in the worker thread.
Defines the event handler to be called when the worker thread receives a message sent by the host thread through **postMessage**. The event handler is executed in the worker thread.
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9).onmessage<sup>9+</sup> instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.onmessage<sup>9+</sup>](#onmessage9-1).
Defines the event handler to be called when the worker thread receives a message that cannot be deserialized. The event handler is executed in the worker thread.
Defines the event handler to be called when the worker thread receives a message that cannot be deserialized. The event handler is executed in the worker thread.
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>](#threadworkerglobalscope9).onmessageerror<sup>9+</sup> instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.onmessageerror<sup>9+</sup>](#onmessageerror9-1).
Defines the event handler to be called when an exception occurs during worker execution. The event handler is executed in the worker thread.
Defines the event handler to be called when an exception occurs during worker execution. The event handler is executed in the worker thread.
> **NOTE**<br>
> **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [GlobalScope<sup>9+</sup>](#globalscope9).onerror instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [GlobalScope<sup>9+</sup>.onerror<sup>9+</sup>](#onerror9-1).