未验证 提交 1651e707 编写于 作者: O openharmony_ci 提交者: Gitee

!17783 翻译完成:16863 workscheduler错误修改

Merge pull request !17783 from wusongqing/TR16863
......@@ -59,6 +59,7 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops.
```
Import the **WorkSchedulerExtensionAbility** module.
```js
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';
```
......@@ -78,7 +79,6 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops.
}
```
3. Start a Work Scheduler task.
```ts
......@@ -106,7 +106,6 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops.
}
```
4. Stop the Work Scheduler task.
```ts
......@@ -132,10 +131,8 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops.
} catch (error) {
console.error(`workschedulerLog stopWork failed. code is ${error.code} message is ${error.message}`);
}
```
5. Obtain a specified Work Scheduler task.
```ts
......@@ -187,7 +184,7 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops.
try{
workScheduler.isLastWorkTimeOut(500, (error, res) =>{
if (error) {
onsole.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`);
console.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`);
} else {
console.info(`workschedulerLog isLastWorkTimeOut success, data is: ${res}`);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册