// For the script URL "entry/ets/workers/worker.ts" in the stage model:
// entry is the value of the name attribute under module in the module.json5 file.
// ets indicates the programming language in use.
// entry is the value of the name attribute under module in the module.json5 file, and ets indicates the programming language in use.
// The script URL is related to the level of the workers directory where the worker file is located and is irrelevant to the file where the new worker is located.
// In the esmodule build scenario of the stage model, the script URL specification @bundle:bundlename/entryname/ets/workerdir/workerfile is added.
// @bundle is a fixed label, bundlename indicates the bundle name, entryname indicates the module name, and ets indicates the programming language in use.
// workerdir indicates the directory where the worker file is located, and workerfile indicates the worker file name.
// In the stage model, the workers directory is at the same level as the pages directory in the entry module, and bundlename is com.example.workerdemo.
// In the stage model, the workers directory is at the same level as the parent directory of the pages directory in the entry module, and bundlename is com.example.workerdemo.
Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file.
Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file.
(1) The worker script directory and **pages** directory are at the same level.
(1) The **workers** directory and **pages** directory are at the same level.
In the FA model:
...
...
@@ -125,7 +133,7 @@ In the stage model:
}
```
(2) The worker script directory and **pages** directory are at different levels.
(2) The **workers** directory and **pages** directory are at different levels.
In the FA model:
...
...
@@ -178,7 +186,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| type | string | Yes | Type of the event for which the event listener is to be removed. |
| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. |
| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. Callback of the event listener to remove.|
**Error codes**
...
...
@@ -712,7 +729,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
// For the script URL "entry/ets/workers/worker.ts" in the stage model:
// entry is the value of the name attribute under module in the module.json5 file.
// ets indicates the programming language in use.
```
Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file.
Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file.
(1) The worker script directory and **pages** directory are at the same level.
(1) The **workers** directory and **pages** directory are at the same level.
In the FA model:
...
...
@@ -1207,7 +1233,7 @@ In the stage model:
}
}
```
(2) The worker script directory and **pages** directory are at different levels.
(2) The **workers** directory and **pages** directory are at different levels.
In the FA model:
```json
...
...
@@ -1594,6 +1620,14 @@ Dispatches the event defined for the worker thread.