提交 771023a7 编写于 作者: G Gloria

Update docs against 22278+22435

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 54e4c8f9
...@@ -597,8 +597,8 @@ Provides the information about the suspension delay. ...@@ -597,8 +597,8 @@ Provides the information about the suspension delay.
| LOCATION | 4 | Positioning and navigation. | | LOCATION | 4 | Positioning and navigation. |
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task. | | BLUETOOTH_INTERACTION | 5 | Bluetooth-related task. |
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection. | | MULTI_DEVICE_CONNECTION | 6 | Multi-device connection. |
| WIFI_INTERACTION | 7 | WLAN-related (system API).| | WIFI_INTERACTION | 7 | WLAN-related.<br>**System API**: This is a system API. |
| VOIP | 8 | Audio and video calls (system API). | | VOIP | 8 | Audio and video calls.<br/>**System API**: This is a system API. |
| TASK_KEEPING | 9 | Computing task (effective only for specific devices). | | TASK_KEEPING | 9 | Computing task (effective only for specific devices). |
## EfficiencyResourcesRequest ## EfficiencyResourcesRequest
......
...@@ -17,66 +17,6 @@ The **TaskPool** APIs return error codes in numeric format. For details about th ...@@ -17,66 +17,6 @@ The **TaskPool** APIs return error codes in numeric format. For details about th
import taskpool from '@ohos.taskpool'; import taskpool from '@ohos.taskpool';
``` ```
## Priority
Enumerates the priorities available for created tasks. (This enum is not supported yet.)
**System capability**: SystemCapability.Utils.Lang
| Name| Value| Description|
| -------- | -------- | -------- |
| HIGH | 0 | The task has a high priority.|
| MEDIUM | 1 | The task has a medium priority.|
| LOW | 2 | The task has a low priority.|
## Task
Implements a task. Before using any of the following APIs, you must create a **Task** instance.
### constructor
constructor(func: Function, ...args: unknown[])
A constructor used to create a **Task** instance.
**System capability**: SystemCapability.Utils.Lang
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | --------- | ---- | -------------------------------------------------------------------- |
| func | Function | Yes | Function to be passed in for task execution. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). |
| args | unknown[] | No | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types). The default value is **undefined**.|
**Error codes**
For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md).
| ID| Error Message |
| -------- | --------------------------------------- |
| 10200014 | The function is not mark as concurrent. |
**Example**
```ts
@Concurrent
function printArgs(args) {
console.log("printArgs: " + args);
return args;
}
let task = new taskpool.Task(printArgs, "this is my first Task");
```
### Attributes
**System capability**: SystemCapability.Utils.Lang
| Name | Type | Readable| Writable| Description |
| --------- | --------- | ---- | ---- | ------------------------------------------------------------------------- |
| function | Function | Yes | Yes | Function to be passed in during task creation. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). |
| arguments | unknown[] | Yes | Yes | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
## taskpool.execute ## taskpool.execute
execute(func: Function, ...args: unknown[]): Promise\<unknown> execute(func: Function, ...args: unknown[]): Promise\<unknown>
...@@ -279,6 +219,66 @@ async function taskpoolCancel() { ...@@ -279,6 +219,66 @@ async function taskpoolCancel() {
taskpoolCancel(); taskpoolCancel();
``` ```
## Priority
Enumerates the priorities available for created tasks. (This enum is not supported yet.)
**System capability**: SystemCapability.Utils.Lang
| Name| Value| Description|
| -------- | -------- | -------- |
| HIGH | 0 | The task has a high priority.|
| MEDIUM | 1 | The task has a medium priority.|
| LOW | 2 | The task has a low priority.|
## Task
Implements a task. Before using any of the following APIs, you must create a **Task** instance.
### constructor
constructor(func: Function, ...args: unknown[])
A constructor used to create a **Task** instance.
**System capability**: SystemCapability.Utils.Lang
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | --------- | ---- | -------------------------------------------------------------------- |
| func | Function | Yes | Function to be passed in for task execution. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). |
| args | unknown[] | No | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types). The default value is **undefined**.|
**Error codes**
For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md).
| ID| Error Message |
| -------- | --------------------------------------- |
| 10200014 | The function is not mark as concurrent. |
**Example**
```ts
@Concurrent
function printArgs(args) {
console.log("printArgs: " + args);
return args;
}
let task = new taskpool.Task(printArgs, "this is my first Task");
```
### Attributes
**System capability**: SystemCapability.Utils.Lang
| Name | Type | Readable| Writable| Description |
| --------- | --------- | ---- | ---- | ------------------------------------------------------------------------- |
| function | Function | Yes | Yes | Function to be passed in during task creation. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). |
| arguments | unknown[] | Yes | Yes | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
## Additional Information ## Additional Information
### Sequenceable Data Types ### Sequenceable Data Types
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册