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,13 +80,13 @@ To create a WorkScheduler project in DevEco Studio, perform the following steps:
...
@@ -80,13 +80,13 @@ 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
```ts
import { workAbility } from '@ohos/library';
import { workAbility } from '@ohos/library';
```
```
Inherit from **workAbility** and implement the lifecycle callbacks for the WorkSchedulerExtensionAbility.
Inherit from **workAbility** and implement the lifecycle callbacks for the WorkSchedulerExtensionAbility.
```ts
```ts
export default class WorkTest extends workAbility {
export default class WorkTest extends workAbility {
...
@@ -177,7 +177,7 @@ Inherit from **workAbility** and implement the lifecycle callbacks for the WorkS
...
@@ -177,7 +177,7 @@ 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
{
{
...
@@ -185,7 +185,7 @@ Inherit from **workAbility** and implement the lifecycle callbacks for the WorkS
...
@@ -185,7 +185,7 @@ Inherit from **workAbility** and implement the lifecycle callbacks for the WorkS