未验证 提交 75c469f9 编写于 作者: L LiAn 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md.

Signed-off-by: NLiAn <lian15@huawei.com>
上级 b6fa7cc6
# 延迟任务调度回调 # 延迟任务调度回调
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
``` ```
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility' import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
``` ```
## WorkSchedulerExtensionAbility.onWorkStart ## WorkSchedulerExtensionAbility.onWorkStart
- **系统能力**
SystemCapability.ResourceSchedule.WorkScheduler onWorkStart(work: workScheduler.WorkInfo): void
- **接口** 延迟任务调度开始回调。
onWorkStart(workInfo: WorkInfo);
**系统能力:** SystemCapability.ResourceSchedule.WorkScheduler
- **说明**
延迟任务调度开始回调。 **参数**
- **示例** | 参数名 | 类型 | 必填 | 说明 |
| ---- | --------------------- | ---- | -------------- |
``` | work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | 是 | 指示要添加到执行队列的工作。 |
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) { **示例:**
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
} ```
} export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
``` onWorkStart(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
## WorkSchedulerExtensionAbility.onWorkStop }
- **系统能力** }
SystemCapability.ResourceSchedule.WorkScheduler ```
- **接口** ## WorkSchedulerExtensionAbility.onWorkStop
onWorkStop(workInfo: WorkInfo);
onWorkStop(work: workScheduler.WorkInfo)
- **说明**
延迟任务调度结束回调。 延迟任务调度结束回调。
- **示例** **系统能力:** SystemCapability.ResourceSchedule.WorkScheduler
``` **参数**
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStop(workInfo) { | 参数名 | 类型 | 必填 | 说明 |
console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo)); | ---- | --------------------- | ---- | -------------- |
} | work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | 是 | 指示要添加到执行队列的工作。 |
}
**示例:**
```
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStop(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo));
}
}
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册