提交 1fa626a6 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 8d5fb164
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
> 0.2 - Upload JS API reference documents to **docs/en/application-dev/reference/apis**. If these documents contain figures, upload the figures to the **figures** folder. > 0.2 - Upload JS API reference documents to **docs/en/application-dev/reference/apis**. If these documents contain figures, upload the figures to the **figures** folder.
> >
> 0.3 - Use a .d.ts file for a JS API reference document. **The file name must be in the following format: js-apis-<moduleName>.md**. Examples: > 0.3 - Use a .d.ts file for a JS API reference document. **The file name must be in the following format: js-apis-<moduleName>.md**. Examples:
> > For @ohos.multimedia.audio in the Media subsystem, the file name is **js-apis-audio.md**.
> ​ For @ohos.multimedia.audio in the Media subsystem, the file name is **js-apis-audio.md**. > For @ohos.telephony.sms in the Telephony subsystem, the file name is **js-apis-sms.md**.
>
> ​ For @ohos.telephony.sms in the Telephony subsystem, the file name is **js-apis-sms.md**.
> >
> 0.4 - After uploading a JS API reference document, update the **Readme-EN.md** file in **docs/en/application-dev/reference/apis**. > 0.4 - After uploading a JS API reference document, update the **Readme-EN.md** file in **docs/en/application-dev/reference/apis**.
> >
...@@ -19,17 +17,15 @@ ...@@ -19,17 +17,15 @@
> 0.6 - Use the document title as the level-1 heading. Use the attributes, functions, classes, interfaces, enums, and types under the namespace as level-2 headings. Use the attributes and functions under classes as level-3 headings. > 0.6 - Use the document title as the level-1 heading. Use the attributes, functions, classes, interfaces, enums, and types under the namespace as level-2 headings. Use the attributes and functions under classes as level-3 headings.
> >
> 0.7 - **When introducing an API to an existing module, use the \<sup> tag to mark its earliest version.** > 0.7 - **When introducing an API to an existing module, use the \<sup> tag to mark its earliest version.**
> > Example: For an existing module of API 6, if an attribute is added in API 7, suffix the \<sup> tag to the name of the new attribute, for example, **newAttribute<sup>7+</sup>**.
> ​ Example: For an existing module of API 6, if an attribute is added in API 7, suffix the \<sup> tag to the name of the new attribute, for example, **newAttribute<sup>7+</sup>**. > If a method is added, suffix the \<sup> tag to the method name, for example, **sim.getSimIccId<sup>7+</sup>**. The processing of new interfaces, classes, and enums is similar.
>
> ​ If a method is added, suffix the \<sup> tag to the method name, for example, **sim.getSimIccId<sup>7+</sup>**. The processing of new interfaces, classes, and enums is similar.
> >
> 0.8 - **Deprecated content**: Do not delete the deprecated content directly from the document. Instead, suffix **deprecated** as a superscript to the content, and use the greater-than symbol (>) to introduce the substitute method plus the corresponding link. > 0.8 - **Deprecated content**: Do not delete the deprecated content directly from the document. Instead, suffix **deprecated** as a superscript to the content, and use the greater-than symbol (>) to introduce the substitute method plus the corresponding link.
> > Example: abandonmentMethod<sup>(deprecated) </sup>
> ​ Example: abandonmentMethod<sup>(deprecated) </sup>
> >
> > Discarded. This change is effective since API version 7. You are advised to use [newMethod](#newMethod) instead. > > Discarded. This change is effective since API version 7. You are advised to use [newMethod](#newMethod) instead.
> >
> 0.9 - **Required permissions and system capabilities**: Keep consistent with the code implementation. Provide them at the level of methods, enumerations, and attributes.
> The following describes the instructions for writing a specific API. > The following describes the instructions for writing a specific API.
*** ***
...@@ -42,22 +38,25 @@ ...@@ -42,22 +38,25 @@
> 1.3 - Use the following sentence: "The initial APIs of this module are supported since API version ***x***. Newly added APIs will be marked with a superscript to indicate their earliest API version." Change ***x*** to the actual version. > 1.3 - Use the following sentence: "The initial APIs of this module are supported since API version ***x***. Newly added APIs will be marked with a superscript to indicate their earliest API version." Change ***x*** to the actual version.
> **Note** > **Note**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Describe the module from its functionalities, use cases, and use suggestions in this section. Describe the module from its functionalities, use cases, and use suggestions in this section.
## Modules to Import ## Modules to Import
> *Writing Instructions* > *Writing Instructions*
> >
> 2.1 - Write the modules to import based on the actual conditions. Provide the **import** statement in the form of a code segment. > 2.1 - Write the modules to import based on the actual conditions. Provide the **import** statement in the form of a code segment.
> >
> 2.2 - If no module needs to be imported, change "Modules to Import" to "How to Use" and provide a usage description. > 2.2 - If no module needs to be imported, change "Modules to Import" to "How to Use" and provide a usage description.
> Example of **How to Use**:
> Before using the **AbilityContext**, obtain the **Context** object through **[getContext()]**(***API-reference***.md).
> >
> ​ Example of **How to Use**:
>
> ​ Before using the **AbilityContext**, obtain the **Context** object through **[getContext()]**(***API-reference***.md).
> ```js > ```js
> import ability_featureAbility from '@ohos.ability.featureAbility'; > import ability_featureAbility from '@ohos.ability.featureAbility';
> var context = ability_featureAbility.getContext(); > var context = ability_featureAbility.getContext();
...@@ -67,12 +66,6 @@ Describe the module from its functionalities, use cases, and use suggestions in ...@@ -67,12 +66,6 @@ Describe the module from its functionalities, use cases, and use suggestions in
import call from '@ohos.telephony.call'; import call from '@ohos.telephony.call';
``` ```
## System Capabilities
> *Writing Instructions*
>
> 3.1 - Mandatory.
>
Example: SystemCapability.BundleManager.BundleFramework
## Attributes ## Attributes
...@@ -87,9 +80,9 @@ Example: SystemCapability.BundleManager.BundleFramework ...@@ -87,9 +80,9 @@ Example: SystemCapability.BundleManager.BundleFramework
> 4.4 - For a writable attribute, if only fixed fields are supported, describe them. > 4.4 - For a writable attribute, if only fixed fields are supported, describe them.
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| ---------------- | ----------------------------------------- | ---- | ---- | ------------------------------------------ | | ---------------- | ----------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| pluggedType | [BatteryPluggedType](#BatteryPluggedType) | Yes| No| Charger type of the current device.| | pluggedType | [BatteryPluggedType](#BatteryPluggedType) | Yes| No| Charger type of the current device. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| isBatteryPresent | boolean | Yes| No| Whether the battery is supported or present.| | isBatteryPresent | boolean | Yes| No| Whether the battery is supported or present. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
## Enums ## Enums
...@@ -102,8 +95,8 @@ Example: SystemCapability.BundleManager.BundleFramework ...@@ -102,8 +95,8 @@ Example: SystemCapability.BundleManager.BundleFramework
Provide a brief description of the enum type. Example: Enumerates charger types. Provide a brief description of the enum type. Example: Enumerates charger types.
| Name| Value| Description| | Name| Value| Description|
| ---- | ---- | -------------------------- | | ---- | ---- | ------------------------------------------------------------ |
| NONE | 1 | Unknown type.| | NONE | 1 | Unknown type. <br>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
## Methods ## Methods
...@@ -113,17 +106,17 @@ Provide a brief description of the enum type. Example: Enumerates charger types. ...@@ -113,17 +106,17 @@ Provide a brief description of the enum type. Example: Enumerates charger types.
> >
> 6.2 - Use the actual method name, in the format of ClassName.methodName, as the level-2 heading. For a subscription method, add the subscription event to the method name. > 6.2 - Use the actual method name, in the format of ClassName.methodName, as the level-2 heading. For a subscription method, add the subscription event to the method name.
> >
> Example of a common method: sim.getSimIccId > Example of a common method: sim.getSimIccId
> >
> Example of a subscription method: sim.on('exampleEvent') > Example of a subscription method: sim.on('exampleEvent')
> >
> 6.3 - **Method calling mode**: The description must be the same as that in the .d.ts file. The description must include the parameter type, parameter name, and return value type. > 6.3 - **Method calling mode**: The description must be the same as that in the .d.ts file. The description must include the parameter type, parameter name, and return value type.
> >
> Example: getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void > Example: getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void
> >
> Note: The angle bracket (<>) may be identified as a label and not displayed. To ensure normal display, you can either add a backslash (\\) (in the format of "\\<>") or use escape characters \&lt; and \&gt;. > Note: The angle bracket (<>) may be identified as a label and not displayed. To ensure normal display, you can either add a backslash (\\) (in the format of "\\<>") or use escape characters \&lt; and \&gt;.
> >
> 6.4.1 - **Method description**: Describe the features implemented by the method and include the prerequisites for using the method, the impact of the method, and the permissions required to use the command. (*Example of prerequisites: The method can be called only after the xx method is called; you must ensure that the connection to the Internet is normal. Example of impact: xx does not take effect after this method is called.*) > 6.4.1 - **Method description**: Describe the features implemented by the method and include the prerequisites for using the method, the impact of the method, and the permissions and system capabilities required to use the method. (*Example of prerequisites: This method can be called only after the xx method is called; you must ensure that the connection to the Internet is normal. Example of impact: xx does not take effect after this method is called.*)
> >
> 6.4.2 - **Asynchronous method**: If there are asynchronous methods, describe their return type in the method description. The return type can be a callback function or a **Promise** instance. > 6.4.2 - **Asynchronous method**: If there are asynchronous methods, describe their return type in the method description. The return type can be a callback function or a **Promise** instance.
> >
...@@ -133,7 +126,9 @@ Provide the method name in the following format: (**static** if it is a static m ...@@ -133,7 +126,9 @@ Provide the method name in the following format: (**static** if it is a static m
Describe the method. For details, see 6.4.1 and 6.4.2. Describe the method. For details, see 6.4.1 and 6.4.2.
Required permission: ohos.permission.XXX (Delete this part if no permission is involved. If a system permission is required, describe it.) **Required permission**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**System capabilities**: SystemCapability.xxx.xxx (mandatory)
**Parameters: ** (Optional. Delete this heading if there is no parameter.) **Parameters: ** (Optional. Delete this heading if there is no parameter.)
...@@ -171,7 +166,7 @@ Required permission: ohos.permission.XXX (Delete this part if no permission is i ...@@ -171,7 +166,7 @@ Required permission: ohos.permission.XXX (Delete this part if no permission is i
> >
> 7.3 - If the class or interface contains both attributes and methods, write the attributes above the methods. Write their actual names in separate level-3 headings. > 7.3 - If the class or interface contains both attributes and methods, write the attributes above the methods. Write their actual names in separate level-3 headings.
> >
> If the class of interface contains only attributes, you do not need to create a level-3 heading. Instead, use a table to display the attributes. For details, see [CustomType](#CustomType). > If the class of interface contains only attributes, you do not need to create a level-3 heading. Instead, use a table to display the attributes. For details, see [CustomType](#CustomType).
Describe the class or interface. If there are usage restrictions, describe them as well, for example, whether there is a prerequisite and whether an instance needs to be created by using any method. Describe the class or interface. If there are usage restrictions, describe them as well, for example, whether there is a prerequisite and whether an instance needs to be created by using any method.
...@@ -187,9 +182,9 @@ Describe the class or interface. If there are usage restrictions, describe them ...@@ -187,9 +182,9 @@ Describe the class or interface. If there are usage restrictions, describe them
> >
> 7.4 - Use the actual method name as the level-3 heading. **Do not add a prefix**. For a subscription method, add the corresponding subscription event to the method name. > 7.4 - Use the actual method name as the level-3 heading. **Do not add a prefix**. For a subscription method, add the corresponding subscription event to the method name.
> >
> Example of a common method: getSimIccId > Example of a common method: getSimIccId
> >
> Example of a subscription method: on('exampleEvent') > Example of a subscription method: on('exampleEvent')
> >
> The other instructions are the same as those stipulated in [Methods](#Methods). > The other instructions are the same as those stipulated in [Methods](#Methods).
...@@ -197,7 +192,9 @@ Describe the method calling mode. For details, see 6.3. ...@@ -197,7 +192,9 @@ Describe the method calling mode. For details, see 6.3.
Describe the method. For details, see 6.4.1 and 6.4.2. Describe the method. For details, see 6.4.1 and 6.4.2.
Required permission: ohos.permission.XXX (Delete this part if no permission is involved. If a system permission is required, describe it.) **Required permission**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**System capabilities**: SystemCapability.xxx.xxx (mandatory)
**Parameters: ** (Optional. Delete this heading if there is no parameter.) **Parameters: ** (Optional. Delete this heading if there is no parameter.)
...@@ -229,7 +226,7 @@ Required permission: ohos.permission.XXX (Delete this part if no permission is i ...@@ -229,7 +226,7 @@ Required permission: ohos.permission.XXX (Delete this part if no permission is i
The following is an example of the custom type of a key-value pair. The following is an example of the custom type of a key-value pair.
| Name| Type| Readable|Writable| Description| | Name| Type| Readable| Writable| Description|
| ------------ | ---- | ---- | ---- | ---- | | ------------ | ------------------- | ---- | ---- | ------------------------------------------------------------ |
| parameterUrl | string | Yes| Yes|Media output URI. The following types of URIs are supported: <br/> 1. Relative path whose protocol type is **internal**. Example: <br/>Temporary directory: internal://cache/test.mp4<br/><br/>2. Absolute path. Example:<br/> file:///data/data/ohos.xxx.xxx/files/test.mp4| | parameterUrl | string | Yes| Yes| Media output URI. The following types of URIs are supported: <br/> 1. Relative path whose protocol type is **internal**. Example: <br/>Temporary directory: internal://cache/test.mp4<br/><br/>2. Absolute path. Example:<br/>file:///data/data/ohos.xxx.xxx/files/test.mp4<br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| parameterOne | [CustomEnum](#Enumeration)| Yes| Yes|Describe the attributes. The requirements are similar to those for the parameter description.| | parameterOne | [CustomEnum](#Enumeration)| Yes| Yes| Describe the attributes. The requirements are similar to those for the parameter description. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册