提交 138edbbb 编写于 作者: E ester.zhou

update docs

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 0108bf6b
# Work Scheduler # Work Scheduler
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br/>
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable. > The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
...@@ -100,7 +100,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return ...@@ -100,7 +100,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
``` ```
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 @@ Obtains the latest task status. This API uses a promise to return the result. ...@@ -136,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result.
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);
}) })
``` ```
...@@ -151,7 +151,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -151,7 +151,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------- | | -------- | -------------------- | ---- | ------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application.| | callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application. |
**Return value** **Return value**
...@@ -164,7 +164,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -164,7 +164,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
``` ```
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));
} }
...@@ -182,7 +182,7 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -182,7 +182,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
| Type | Description | | Type | Description |
| -------------------------------------- | ------------------------------ | | -------------------------------------- | ------------------------------ |
| Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application.| | Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application. |
**Example** **Example**
...@@ -190,7 +190,7 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -190,7 +190,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
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 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -233,7 +233,7 @@ Checks whether the last execution of the specified task timed out. This API uses
``` ```
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 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -267,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses
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);
}); });
``` ```
...@@ -291,6 +291,8 @@ Provides detailed information about the task. ...@@ -291,6 +291,8 @@ Provides detailed information about the task.
| repeatCycleTime | number | No | Repeat interval. | | repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. | | repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType ## NetworkType
Enumerates the network types that can trigger the task. Enumerates the network types that can trigger the task.
...@@ -319,7 +321,7 @@ Enumerates the charging types that can trigger the task. ...@@ -319,7 +321,7 @@ Enumerates the charging types that can trigger the task.
| CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. | | CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. |
## BatteryStatus ## BatteryStatus
Enumerates the battery status that can trigger the task. Enumerates the battery states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
...@@ -330,7 +332,7 @@ Enumerates the battery status that can trigger the task. ...@@ -330,7 +332,7 @@ Enumerates the battery status that can trigger the task.
| BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.| | BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.|
## StorageRequest ## StorageRequest
Enumerates the storage status that can trigger the task. Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
- Custom Components - Custom Components
- [Basic Usage](js-components-custom-basic-usage.md) - [Basic Usage](js-components-custom-basic-usage.md)
- [Style Inheritance](js-components-custom-style.md)
- [Custom Events](js-components-custom-events.md) - [Custom Events](js-components-custom-events.md)
- [props](js-components-custom-props.md) - [props](js-components-custom-props.md)
- [Event Parameter](js-components-custom-event-parameter.md) - [Event Parameter](js-components-custom-event-parameter.md)
......
# Style Inheritance
> **NOTE**<br/>
> The APIs of this module are supported since API 9. Updates will be marked with a superscript to indicate their earliest API version.
A custom component has the **inherit-class** attribute, which is defined in the following table.
| Name | Type | Default Value| Mandatory| Description |
| ------------ | ------ | ------ | ---- | ------------------------------------------------------ |
| inherit-class | string | - | No | Class styles inherited from the parent component, seperated by spaces.|
To enable a custom component to inherit the styles of its parent component, set the **inherit-calss** attribute for the custom component.
The example below is a code snippet in the HML file of the parent page that references a custom component named **comp**. This component uses the **inherit-class** attribute to inherit the styles of its parent component: **parent-class1** and **parent-class2**.
```html
<!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element>
<div class="container">
<comp inherit-class="parent-class1 parent-class2" ></comp>
</div>
```
Code snippet in the CSS file of the parent page:
```html
// xxx.css
.parent-class1 {
background-color:red;
border:2px;
}
.parent-class2 {
background-color:green;
border:2px;
}
```
Code snippet in the HML file of the custom component, where **parent-class1** and **parent-class2** are styles inherited from the parent component:
```html
<!--comp.hml-->
<div class="item">
<text class="parent-class1">Style 1 inherited from the parent component</text>
<text class="parent-class2">Style 2 inherited from the parent component</text>
</div>
```
...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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; | Triggered when the Work Scheduler t ...@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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; | Triggered when the Work Scheduler t ...@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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; | Triggered when the Work Scheduler t ...@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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);
}) })
**Stopping and Clearing Work Scheduler Tasks** **Stopping and Clearing Work Scheduler Tasks**
...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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; | Triggered when the Work Scheduler t ...@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
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);
}); });
}) })
...@@ -14,7 +14,7 @@ Each application can subscribe to common events as required. After your applicat ...@@ -14,7 +14,7 @@ Each application can subscribe to common events as required. After your applicat
### Architecture ### Architecture
![](figures/cesfwk_architecture_diagram.png "CES Architecture") ![]( figures/cesfwk_architecture_diagram.png "CES Architecture")
## Directory Structure ## Directory Structure
...@@ -36,10 +36,10 @@ Each application can subscribe to common events as required. After your applicat ...@@ -36,10 +36,10 @@ Each application can subscribe to common events as required. After your applicat
## How to Use ## How to Use
For details, see *CommonEvent Development Guidelines*. For details, see [Common Event Development](../application-dev/notification/common-event.md).
## Repositories Involved ## Repositories Involved
Common Event and Notification Common Event and Notification
[**notification_ces_standard**](https://gitee.com/openharmony/notification_ces_standard) [**notification_ces_standard**](https://gitee.com/openharmony/notification_ces_standard)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册