From a282e31f8c7a09fa3e61107f0142105798485f7c Mon Sep 17 00:00:00 2001 From: zhutianyi Date: Wed, 17 Aug 2022 14:53:53 +0800 Subject: [PATCH] =?UTF-8?q?work=5Fscheduler=E6=96=B0=E5=A2=9E=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhutianyi --- .../reference/apis/js-apis-workScheduler.md | 19 +++++++++++++++++-- .../work-scheduler-dev-guide.md | 19 +++++++++++++++++-- .../work-scheduler-overview.md | 4 +++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-workScheduler.md b/zh-cn/application-dev/reference/apis/js-apis-workScheduler.md index 899d41aa44..d082b3ee5f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-workScheduler.md +++ b/zh-cn/application-dev/reference/apis/js-apis-workScheduler.md @@ -45,7 +45,14 @@ startWork(work: WorkInfo): boolean isRepeat: false, isPersisted: true, bundleName: "com.example.myapplication", - abilityName: "MyExtension" + abilityName: "MyExtension", + parameters: { + mykey0: 2222, + mykey1: "ssssssssssssssssssssssssss", + mykey2: true, + mykey3: 1.5, + mykey4: 213749534591254587511 + } } var res = workScheduler.startWork(workInfo); console.info("workschedulerLog res:" + res); @@ -81,7 +88,14 @@ stopWork(work: WorkInfo, needCancel?: boolean): boolean isRepeat: false, isPersisted: true, bundleName: "com.example.myapplication", - abilityName: "MyExtension" + abilityName: "MyExtension", + parameters: { + mykey0: 2222, + mykey1: "ssssssssssssssssssssssssss", + mykey2: true, + mykey3: 1.5, + mykey4: 213749534591254587511 + } } var res = workScheduler.stopWork(workInfo, false); console.info("workschedulerLog res:" + res); @@ -299,6 +313,7 @@ isLastWorkTimeOut(workId: number): Promise\ | isPersisted | boolean | 否 | 是否持久化保存工作 | | isDeepIdle | boolean | 否 | 是否要求设备进入空闲状态 | | idleWaitTime | number | 否 | 空闲等待时间 | +| parameters | {[key: string]: any} | 否 | 额外数据 | ## NetworkType 触发工作的网络类型。 diff --git a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md index 412d2d2cb2..737af092f2 100644 --- a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md +++ b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md @@ -50,6 +50,7 @@ storageRequest|存储状态| StorageRequest isRepeat|是否循环任务| boolean repeatCycleTime |循环间隔| number repeatCount |循环次数| number +parameters |额外数据| {[key: string]: any} **表3** 延迟任务回调接口 @@ -85,7 +86,14 @@ onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 isRepeat: false, isPersisted: true, bundleName: "com.example.myapplication", - abilityName: "MyExtension" + abilityName: "MyExtension", + parameters: { + mykey0: 2222, + mykey1: "ssssssssssssssssssssssssss", + mykey2: true, + mykey3: 1.5, + mykey4: 213749534591254587511 + } } var res = workScheduler.startWork(workInfo); console.info("workschedulerLog res:" + res); @@ -103,7 +111,14 @@ onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 isRepeat: false, isPersisted: true, bundleName: "com.example.myapplication", - abilityName: "MyExtension" + abilityName: "MyExtension", + parameters: { + mykey0: 2222, + mykey1: "ssssssssssssssssssssssssss", + mykey2: true, + mykey3: 1.5, + mykey4: 213749534591254587511 + } } var res = workScheduler.stopWork(workInfo, false); console.info("workschedulerLog res:" + res); diff --git a/zh-cn/application-dev/task-management/work-scheduler-overview.md b/zh-cn/application-dev/task-management/work-scheduler-overview.md index c2ce0fe7fe..16465205d0 100644 --- a/zh-cn/application-dev/task-management/work-scheduler-overview.md +++ b/zh-cn/application-dev/task-management/work-scheduler-overview.md @@ -28,4 +28,6 @@ (2)至少要设置一个满足的条件。 -(3)重复任务时间间隔至少20分钟,当设置重复任务时间间隔时,必须设置始终重复和重复次数中的一个。 \ No newline at end of file +(3)重复任务时间间隔至少20分钟,当设置重复任务时间间隔时,必须设置始终重复和重复次数中的一个。 + +(4)额外数据支持number、string、bool三种类型。 \ No newline at end of file -- GitLab