提交 e2dcdadb 编写于 作者: G Gloria

Update docs against 17296

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 3f0473cf
...@@ -12,7 +12,7 @@ Figure 1 shows the working principle of Work Scheduler. ...@@ -12,7 +12,7 @@ Figure 1 shows the working principle of Work Scheduler.
![WorkSchedulerExtensionAbility](figures/WorkSchedulerExtensionAbility.png) ![WorkSchedulerExtensionAbility](figures/WorkSchedulerExtensionAbility.png)
An application starts, stops, and obtains Work Scheduler tasks through the [workScheduler APIs](../reference/apis/js-apis-resourceschedule-workScheduler.md). It implements the task starting or stopping execution logic through the [Work Scheduler callbacks](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md). An application registers, cancels, and queries Work Scheduler tasks through the [workScheduler APIs](../reference/apis/js-apis-resourceschedule-workScheduler.md). It starts and stops Work Scheduler tasks through the [WorkSchedulerExtensionAbility APIs](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md).
The application service layer detects and determines the conditions. If the preset conditions are met, the application service layer calls back the **WorkSchedulerExtensionAbility** object to start the application and triggers the **onWorkStart** and **onWorkStop** callbacks. The application service layer detects and determines the conditions. If the preset conditions are met, the application service layer calls back the **WorkSchedulerExtensionAbility** object to start the application and triggers the **onWorkStart** and **onWorkStop** callbacks.
...@@ -80,27 +80,27 @@ To create a WorkScheduler project in DevEco Studio, perform the following steps: ...@@ -80,27 +80,27 @@ To create a WorkScheduler project in DevEco Studio, perform the following steps:
3. In the **./entry/src/main/ets** directory under the **entry** module of the project, create a directory named **workAbility**. In the **workAbility** directory, create an ArkTS file named **WorkTest.ets** and implement the callbacks for Work Scheduler. 3. In the **./entry/src/main/ets** directory under the **entry** module of the project, create a directory named **workAbility**. In the **workAbility** directory, create an ArkTS file named **WorkTest.ets** and implement the callbacks for Work Scheduler.
Import the module. Import the module.
```ts
import { workAbility } from '@ohos/library';
```
Inherit from **workAbility** and implement the lifecycle callbacks for the WorkSchedulerExtensionAbility. ```ts
import { workAbility } from '@ohos/library';
```
```ts Inherit from **workAbility** and implement the lifecycle callbacks for the WorkSchedulerExtensionAbility.
export default class WorkTest extends workAbility {
onWorkStart(workInfo) {
console.log(`onWorkStartTest start ${JSON.stringify(workInfo)}`);
super.onWorkStart(workInfo);
}
onWorkStopTest(workInfo) { ```ts
super.onWorkStop(workInfo); export default class WorkTest extends workAbility {
console.log(`onWorkStop value`); onWorkStart(workInfo) {
} console.log(`onWorkStartTest start ${JSON.stringify(workInfo)}`);
} super.onWorkStart(workInfo);
``` }
onWorkStopTest(workInfo) {
super.onWorkStop(workInfo);
console.log(`onWorkStop value`);
}
}
```
### Implementing Work Scheduler ### Implementing Work Scheduler
...@@ -177,20 +177,20 @@ Inherit from **workAbility** and implement the lifecycle callbacks for the WorkS ...@@ -177,20 +177,20 @@ Inherit from **workAbility** and implement the lifecycle callbacks for the WorkS
### Setting the Configuration File ### Setting the Configuration File
1. Register the WorkSchedulerExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) under the **entry** module. Set **type** to **workScheduler** and **srcEntrance** to the code path of the WorkSchedulerExtensionAbility component. 1. Register the WorkSchedulerExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) under the **entry** module. Set **type** to **workScheduler** and **srcEnty** to the code path of the WorkSchedulerExtensionAbility component.
```json ```json
{ {
"module": { "module": {
"extensionAbilities": [ "extensionAbilities": [
{ {
"name": "WorkTest", "name": "WorkTest",
"srcEntrance": "./ets/workAbility/WorkTest.ets", "srcEnty": "./ets/workAbility/WorkTest.ets",
"label": "$string:WorkSchedulerExtensionAbility_label", "label": "$string:WorkSchedulerExtensionAbility_label",
"description": "$string:WorkSchedulerExtensionAbility_desc", "description": "$string:WorkSchedulerExtensionAbility_desc",
"type": "workScheduler" "type": "workScheduler"
} }
] ]
} }
} }
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册