未验证 提交 74deca3c 编写于 作者: O openharmony_ci 提交者: Gitee

!4726 work-scheduler相关文档更新

Merge pull request !4726 from 陈明/master
...@@ -100,7 +100,7 @@ getWorkStatus(workId: number, callback : AsyncCallback\<WorkInfo>): void ...@@ -100,7 +100,7 @@ getWorkStatus(workId: number, callback : AsyncCallback\<WorkInfo>): void
``` ```
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else { } else {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
...@@ -136,7 +136,7 @@ getWorkStatus(workId: number): Promise\<WorkInfo> ...@@ -136,7 +136,7 @@ getWorkStatus(workId: number): Promise\<WorkInfo>
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
} }
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
}) })
``` ```
...@@ -164,7 +164,7 @@ obtainAllWorks(callback : AsyncCallback\<void>): Array\<WorkInfo> ...@@ -164,7 +164,7 @@ obtainAllWorks(callback : AsyncCallback\<void>): Array\<WorkInfo>
``` ```
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
} }
...@@ -190,7 +190,7 @@ obtainAllWorks(): Promise<Array\<WorkInfo>> ...@@ -190,7 +190,7 @@ obtainAllWorks(): Promise<Array\<WorkInfo>>
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
}) })
``` ```
...@@ -233,7 +233,7 @@ isLastWorkTimeOut(workId: number, callback : AsyncCallback\<void>): boolean ...@@ -233,7 +233,7 @@ isLastWorkTimeOut(workId: number, callback : AsyncCallback\<void>): boolean
``` ```
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
} }
...@@ -267,7 +267,7 @@ isLastWorkTimeOut(workId: number): Promise\<boolean> ...@@ -267,7 +267,7 @@ isLastWorkTimeOut(workId: number): Promise\<boolean>
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}) })
.catch(err => { .catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
}); });
``` ```
......
...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else { } else {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatuscallback success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatuscallback success,' + item + ' is:' + res[item]);
...@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
} }
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
}) })
...@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
} }
...@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
}) })
**停止并清除任务** **停止并清除任务**
...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
} }
...@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调 ...@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}) })
.catch(err => { .catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
}); });
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册