提交 f7fd1f34 编写于 作者: G Gloria

Update docs against 10317+10328

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 0b79ec67
...@@ -27,8 +27,8 @@ If this API is called for the first time, a root directory will be created. ...@@ -27,8 +27,8 @@ If this API is called for the first time, a root directory will be created.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------- | | -------- | ---------------------- | ---- | -------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the local root directory.| | callback | AsyncCallback\<string> | Yes | Callback used to return the local root directory.|
**Example** **Example**
...@@ -56,7 +56,7 @@ If this API is called for the first time, a root directory will be created. ...@@ -56,7 +56,7 @@ If this API is called for the first time, a root directory will be created.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ----------- | | ---------------- | ---------------------- |
| Promise\<string> | Promise used to return the local root directory.| | Promise\<string> | Promise used to return the local root directory.|
**Example** **Example**
...@@ -81,8 +81,8 @@ Verifies whether a specific PID and UID have the given permission. This API uses ...@@ -81,8 +81,8 @@ Verifies whether a specific PID and UID have the given permission. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | -------------------- | | ---------- | --------------------------------------- | ---- | ------------------------------------- |
| permission | string | Yes | Name of the permission to verify. | | permission | string | Yes | Name of the permission to verify. |
| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. | | options | [PermissionOptions](#permissionoptions) | Yes | Permission options. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.| | callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
...@@ -110,8 +110,8 @@ Verifies whether the current PID and UID have the given permission. This API use ...@@ -110,8 +110,8 @@ Verifies whether the current PID and UID have the given permission. This API use
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------- | ---- | -------------------- | | ---------- | ---------------------- | ---- | ------------------------------------- |
| permission | string | Yes | Name of the permission to verify. | | permission | string | Yes | Name of the permission to verify. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.| | callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
...@@ -133,15 +133,15 @@ Verifies whether a specific PID and UID have the given permission. This API uses ...@@ -133,15 +133,15 @@ Verifies whether a specific PID and UID have the given permission. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | -------- | | ---------- | --------------------------------------- | ---- | ---------------- |
| permission | string | Yes | Name of the permission to verify.| | permission | string | Yes | Name of the permission to verify.|
| options | [PermissionOptions](#permissionoptions) | No | Permission options. | | options | [PermissionOptions](#permissionoptions) | No | Permission options. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ---------------------------------- | | ---------------- | ----------------------------------------------------------- |
| Promise\<number> | Promise used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.| | Promise\<number> | Promise used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
**Example** **Example**
...@@ -168,8 +168,8 @@ Requests certain permissions from the system. This API uses an asynchronous call ...@@ -168,8 +168,8 @@ Requests certain permissions from the system. This API uses an asynchronous call
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------- | ---- | ----------------------------------- | | -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- |
| permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. | | permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. |
| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.| | requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Callback used to return the permission request result. | | resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Callback used to return the permission request result. |
...@@ -242,8 +242,8 @@ Obtains information about the current application. This API uses an asynchronous ...@@ -242,8 +242,8 @@ Obtains information about the current application. This API uses an asynchronous
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------ | | -------- | ------------------------------- | ---- | ------------------------ |
| callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information.| | callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information.|
**Example** **Example**
...@@ -267,7 +267,7 @@ Obtains information about the current application. This API uses a promise to re ...@@ -267,7 +267,7 @@ Obtains information about the current application. This API uses a promise to re
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------- | --------- | | ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise used to return the application information.| | Promise\<ApplicationInfo> | Promise used to return the application information.|
**Example** **Example**
...@@ -293,8 +293,8 @@ Obtains the bundle name of this ability. This API uses an asynchronous callback ...@@ -293,8 +293,8 @@ Obtains the bundle name of this ability. This API uses an asynchronous callback
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------ | | -------- | ---------------------- | ---- | ----------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.| | callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.|
**Example** **Example**
...@@ -318,7 +318,7 @@ Obtains the bundle name of this ability. This API uses a promise to return the r ...@@ -318,7 +318,7 @@ Obtains the bundle name of this ability. This API uses a promise to return the r
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ---------------- | | ---------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.| | Promise\<string> | Promise used to return the bundle name.|
**Example** **Example**
...@@ -344,8 +344,8 @@ Obtains information about the current process, including the PID and process nam ...@@ -344,8 +344,8 @@ Obtains information about the current process, including the PID and process nam
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------- | | -------- | --------------------------- | ---- | -------------------- |
| callback | AsyncCallback\<ProcessInfo> | Yes | Callback used to return the process information.| | callback | AsyncCallback\<ProcessInfo> | Yes | Callback used to return the process information.|
**Example** **Example**
...@@ -369,7 +369,7 @@ Obtains information about the current process, including the PID and process nam ...@@ -369,7 +369,7 @@ Obtains information about the current process, including the PID and process nam
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------- | | --------------------- | -------------- |
| Promise\<ProcessInfo> | Promise used to return the process information.| | Promise\<ProcessInfo> | Promise used to return the process information.|
**Example** **Example**
...@@ -397,8 +397,8 @@ This API is available only to Page abilities. ...@@ -397,8 +397,8 @@ This API is available only to Page abilities.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------------------------- | | -------- | --------------------------- | ---- | ---------------------------------------------- |
| callback | AsyncCallback\<ElementName> | Yes | Callback used to return the **ohos.bundle.ElementName** object.| | callback | AsyncCallback\<ElementName> | Yes | Callback used to return the **ohos.bundle.ElementName** object.|
**Example** **Example**
...@@ -424,7 +424,7 @@ This API is available only to Page abilities. ...@@ -424,7 +424,7 @@ This API is available only to Page abilities.
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------ | | --------------------- | ------------------------------------------ |
| Promise\<ElementName> | Promise used to return the **ohos.bundle.ElementName** object.| | Promise\<ElementName> | Promise used to return the **ohos.bundle.ElementName** object.|
**Example** **Example**
...@@ -448,8 +448,8 @@ Obtains the name of the current process. This API uses an asynchronous callback ...@@ -448,8 +448,8 @@ Obtains the name of the current process. This API uses an asynchronous callback
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ---------- | | -------- | ---------------------- | ---- | -------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the process name.| | callback | AsyncCallback\<string> | Yes | Callback used to return the process name.|
**Example** **Example**
...@@ -473,7 +473,7 @@ Obtains the name of the current process. This API uses a promise to return the r ...@@ -473,7 +473,7 @@ Obtains the name of the current process. This API uses a promise to return the r
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ---------- | | ---------------- | -------------------- |
| Promise\<string> | Promise used to return the process name.| | Promise\<string> | Promise used to return the process name.|
**Example** **Example**
...@@ -499,8 +499,8 @@ Obtains the bundle name of the calling ability. This API uses an asynchronous ca ...@@ -499,8 +499,8 @@ Obtains the bundle name of the calling ability. This API uses an asynchronous ca
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ---------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.| | callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.|
**Example** **Example**
...@@ -524,7 +524,7 @@ Obtains the bundle name of the calling ability. This API uses a promise to retur ...@@ -524,7 +524,7 @@ Obtains the bundle name of the calling ability. This API uses a promise to retur
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | -------------- | | --------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.| | Promise\<string> | Promise used to return the bundle name.|
**Example** **Example**
...@@ -548,8 +548,8 @@ Obtains the cache directory of the application in the internal storage. This API ...@@ -548,8 +548,8 @@ Obtains the cache directory of the application in the internal storage. This API
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | --------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the cache directory.| | callback | AsyncCallback\<string> | Yes | Callback used to return the cache directory.|
**Example** **Example**
...@@ -577,7 +577,7 @@ Obtains the cache directory of the application in the internal storage. This API ...@@ -577,7 +577,7 @@ Obtains the cache directory of the application in the internal storage. This API
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | --------------- | | --------------- | ------------------------- |
| Promise\<string> | Promise used to return the cache directory.| | Promise\<string> | Promise used to return the cache directory.|
**Example** **Example**
...@@ -601,8 +601,8 @@ Obtains the file directory of the application in the internal storage. This API ...@@ -601,8 +601,8 @@ Obtains the file directory of the application in the internal storage. This API
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the file directory.| | callback | AsyncCallback\<string> | Yes | Callback used to return the file directory.|
**Example** **Example**
...@@ -630,7 +630,7 @@ Obtains the file directory of the application in the internal storage. This API ...@@ -630,7 +630,7 @@ Obtains the file directory of the application in the internal storage. This API
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ------------------- | | --------------- | ------------------------- |
| Promise\<string> | Promise used to return the file directory.| | Promise\<string> | Promise used to return the file directory.|
**Example** **Example**
...@@ -656,8 +656,8 @@ If the distributed file path does not exist, the system will create one and retu ...@@ -656,8 +656,8 @@ If the distributed file path does not exist, the system will create one and retu
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ---------------------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the distributed file path. If the distributed file path does not exist, the system will create one and return the created path.| | callback | AsyncCallback\<string> | Yes | Callback used to return the distributed file path. If the distributed file path does not exist, the system will create one and return the created path.|
**Example** **Example**
...@@ -687,7 +687,7 @@ If the distributed file path does not exist, the system will create one and retu ...@@ -687,7 +687,7 @@ If the distributed file path does not exist, the system will create one and retu
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ----------------------------------- | | --------------- | ------------------------- |
| Promise\<string> | Promise used to return the distributed file path. If this API is called for the first time, a new path will be created.| | Promise\<string> | Promise used to return the distributed file path. If this API is called for the first time, a new path will be created.|
**Example** **Example**
...@@ -710,8 +710,8 @@ Obtains the application type. This API uses an asynchronous callback to return t ...@@ -710,8 +710,8 @@ Obtains the application type. This API uses an asynchronous callback to return t
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the application type.| | callback | AsyncCallback\<string> | Yes | Callback used to return the application type.|
**Example** **Example**
...@@ -739,7 +739,7 @@ Obtains the application type. This API uses a promise to return the result. ...@@ -739,7 +739,7 @@ Obtains the application type. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ------------------ | | --------------- | ------------------------- |
| Promise\<string> | Promise used to return the application type.| | Promise\<string> | Promise used to return the application type.|
**Example** **Example**
...@@ -762,8 +762,8 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron ...@@ -762,8 +762,8 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | --------------------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[HapModuleInfo](#hapmoduleinfo)> | Yes | Callback used to return the **ModuleInfo** object.| | callback | AsyncCallback\<[HapModuleInfo](#hapmoduleinfo)> | Yes | Callback used to return the **ModuleInfo** object.|
**Example** **Example**
...@@ -791,7 +791,7 @@ Obtains the **ModuleInfo** object of the application. This API uses a promise to ...@@ -791,7 +791,7 @@ Obtains the **ModuleInfo** object of the application. This API uses a promise to
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ------------------ | | --------------- | ------------------------- |
| Promise\<[HapModuleInfo](#hapmoduleinfo)> | Promise used to return the **ModuleInfo** object.| | Promise\<[HapModuleInfo](#hapmoduleinfo)> | Promise used to return the **ModuleInfo** object.|
**Example** **Example**
...@@ -814,8 +814,8 @@ Obtains the version information of the application. This API uses an asynchronou ...@@ -814,8 +814,8 @@ Obtains the version information of the application. This API uses an asynchronou
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | ------------------------------ | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AppVersionInfo](#appversioninfo)> | Yes | Callback used to return the version information.| | callback | AsyncCallback\<[AppVersionInfo](#appversioninfo)> | Yes | Callback used to return the version information.|
**Example** **Example**
...@@ -843,7 +843,7 @@ Obtains the version information of the application. This API uses a promise to r ...@@ -843,7 +843,7 @@ Obtains the version information of the application. This API uses a promise to r
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | --------- | | --------------- | ------------------------- |
| Promise\<[AppVersionInfo](#appversioninfo)> | Promise used to return the version information.| | Promise\<[AppVersionInfo](#appversioninfo)> | Promise used to return the version information.|
**Example** **Example**
...@@ -866,9 +866,9 @@ Obtains information about this ability. This API uses an asynchronous callback t ...@@ -866,9 +866,9 @@ Obtains information about this ability. This API uses an asynchronous callback t
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | --------------------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | Yes | Callback used to return the ability information.| | callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | Yes |Callback used to return the ability information.|
**Example** **Example**
...@@ -895,7 +895,7 @@ Obtains information about this ability. This API uses a promise to return the re ...@@ -895,7 +895,7 @@ Obtains information about this ability. This API uses a promise to return the re
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ------------------ | | --------------- | ------------------------- |
| Promise\<[AbilityInfo](#abilityInfo)> | Promise used to return the ability information.| | Promise\<[AbilityInfo](#abilityInfo)> | Promise used to return the ability information.|
**Example** **Example**
...@@ -919,8 +919,8 @@ Obtains the context of the application. ...@@ -919,8 +919,8 @@ Obtains the context of the application.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | ---------- | | --------- |------ |
| Context | Application context.| | Context |Application context.|
**Example** **Example**
...@@ -929,12 +929,59 @@ import featureAbility from '@ohos.ability.featureAbility' ...@@ -929,12 +929,59 @@ import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext().getApplicationContext(); var context = featureAbility.getContext().getApplicationContext();
``` ```
## Context.getExternalCacheDir
getExternalCacheDir(callback: AsyncCallback\<string>): void
Obtains the external cache directory of the application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ------------------ |
| callback | AsyncCallback\<string> | Yes | Callback used to return the absolute path of the cache directory.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getExternalCacheDir()
```
## Context.getExternalCacheDir
getExternalCacheDir(): Promise\<string>;
Obtains the external cache directory of the application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type | Description |
| ---------------- | ---------------- |
| Promise\<string> | Promise used to return the absolute path of the cache directory.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getExternalCacheDir().then((data) => {
console.info("=======================>getExternalCacheDirCallback====================>");
console.info("====>data====>" + JSON.stringify(data));
});
```
## PermissionOptions ## PermissionOptions
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Readable/Writable| Type | Mandatory | Description | | Name| Readable/Writable| Type | Mandatory| Description |
| ---- | ---- | ------ | ---- | ----- | | ---- | -------- | ------ | ---- | ------ |
| pid | Read-only | number | No | Process ID.| | pid | Read-only | number | No | Process ID.|
| uid | Read-only | number | No | User ID.| | uid | Read-only | number | No | User ID.|
...@@ -942,8 +989,8 @@ var context = featureAbility.getContext().getApplicationContext(); ...@@ -942,8 +989,8 @@ var context = featureAbility.getContext().getApplicationContext();
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Readable/Writable| Type | Mandatory | Description | | Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | ---- | -------------- | ---- | ---------- | | ----------- | -------- | -------------- | ---- | ------------------ |
| requestCode | Read-only | number | Yes | Request code passed.| | requestCode | Read-only | number | Yes | Request code passed.|
| permissions | Read-only | Array\<string> | Yes | Permissions requested. | | permissions | Read-only | Array\<string> | Yes | Permissions requested. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. | | authResults | Read-only | Array\<number> | Yes | Permission request result. |
...@@ -952,8 +999,8 @@ var context = featureAbility.getContext().getApplicationContext(); ...@@ -952,8 +999,8 @@ var context = featureAbility.getContext().getApplicationContext();
Describes the HAP module information. Describes the HAP module information.
| Name | Type | Readable | Writable | Description | | Name | Type| Readable| Writable| Description|
| ---------------- | ------------------- | -------- | -------- | ----------------------------------------- | | ------ | ------ | ------ | ------ | ------ |
| name | string | Yes | No | Module name. | | name | string | Yes | No | Module name. |
| description | string | Yes | No | Module description. | | description | string | Yes | No | Module description. |
| descriptionId | number | Yes | No | Module description ID. | | descriptionId | number | Yes | No | Module description ID. |
...@@ -963,19 +1010,18 @@ Describes the HAP module information. ...@@ -963,19 +1010,18 @@ Describes the HAP module information.
| iconId | number | Yes | No | Module icon ID. | | iconId | number | Yes | No | Module icon ID. |
| backgroundImg | string | Yes | No | Module background image. | | backgroundImg | string | Yes | No | Module background image. |
| supportedModes | number | Yes | No | Running modes supported by the module. | | supportedModes | number | Yes | No | Running modes supported by the module. |
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running. | | reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running.|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the module. | | deviceTypes | Array\<string> | Yes | No | Device types supported by the module.|
| abilityInfo | Array\<AbilityInfo> | Yes | No | Ability information. | | abilityInfo | Array\<AbilityInfo> | Yes | No | Ability information. |
| moduleName | string | Yes | No | Module name. | | moduleName | string | Yes | No | Module name. |
| mainAbilityName | string | Yes | No | Name of the main ability. | | mainAbilityName | string | Yes | No | Name of the main ability. |
| installationFree | boolean | Yes | No | Whether installation-free is supported. | | installationFree | boolean | Yes | No | Whether installation-free is supported. |
| mainElementName | string | Yes | No | Information about the main ability. | | mainElementName | string | Yes| No| Information about the main ability.|
## AppVersionInfo ## AppVersionInfo
| Name | Type| Readable | Writable | Description|
| Name | Type | Readable | Writable | Description | | ------ | ------ | ------| ------ | ------ |
| ----------- | ------ | ---- | ---- | ------- |
| appName | string | Yes | No | Module name. | | appName | string | Yes | No | Module name. |
| versionCode | number | Yes | No | Module description.| | versionCode | number | Yes | No | Module description. |
| versionName | string | Yes | No | Module description ID.| | versionName | string | Yes | No | Module description ID. |
...@@ -26,16 +26,16 @@ Creates a **URLSearchParams** instance. ...@@ -26,16 +26,16 @@ Creates a **URLSearchParams** instance.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| init | string[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>- **Record&lt;string, string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object | | init | string[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>- **Record&lt;string, string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object|
**Example** **Example**
```js ```js
var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); let objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2}); let objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'});
var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); let objectParams2 = new Url.URLSearchParams('?fod=1&bard=2');
var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2');
var params = new Url.URLSearchParams(urlObject.search); let params = new Url.URLSearchParams(urlObject.search);
``` ```
...@@ -59,7 +59,7 @@ Appends a key-value pair into the query string. ...@@ -59,7 +59,7 @@ Appends a key-value pair into the query string.
```js ```js
let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', '3');
``` ```
...@@ -110,9 +110,9 @@ Obtains all the key-value pairs based on the specified key. ...@@ -110,9 +110,9 @@ Obtains all the key-value pairs based on the specified key.
```js ```js
let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); let params = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. params.append('fod', '3'); // Add a second value for the fod parameter.
console.log(params.getAll('fod')) // Output ["1","3"]. console.log(params.getAll('fod').toString()) // Output ["1","3"].
``` ```
...@@ -133,7 +133,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -133,7 +133,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2"); let searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
} }
...@@ -192,15 +192,14 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -192,15 +192,14 @@ Obtains the value of the first key-value pair based on the specified key.
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Returns the value of the first key-value pair if obtained. | | string | Returns the value of the first key-value pair if obtained. |
| null | Returns null if no value is obtained. | | null | Returns **null** if no value is obtained.|
**Example** **Example**
```js ```js
var paramsOject = new Url.URLSearchParams(document.location.search.substring(1)); let paramsObject = new Url.URLSearchParams('name=Jonathan&age=18');
var name = paramsOject.get("name"); // is the string "Jonathan" let name = paramsObject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 let age = parseInt(paramsObject.get("age"), 10); // is the number 18
var address = paramsOject.get("address"); // null
``` ```
...@@ -253,7 +252,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -253,7 +252,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
```js ```js
let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', '3'); // Add a third parameter.
``` ```
...@@ -268,7 +267,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -268,7 +267,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object let searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
``` ```
...@@ -291,7 +290,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -291,7 +290,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example** **Example**
```js ```js
var searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing let searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
} }
...@@ -315,7 +314,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -315,7 +314,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example** **Example**
```js ```js
var searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing let searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
} }
...@@ -365,7 +364,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -365,7 +364,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
```js ```js
let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new Url.URLSearchParams(url.search.slice(1)); let params = new Url.URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', '3');
console.log(params.toString()); console.log(params.toString());
``` ```
...@@ -405,16 +404,16 @@ Creates a URL. ...@@ -405,16 +404,16 @@ Creates a URL.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| url | string | Yes | Input object. | | url | string | Yes | Input object. |
| base | string \ |& URL | No | Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object | | base | string \| URL | No| Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object|
**Example** **Example**
```js ```js
var mm = 'http://username:password@host:8080'; let mm = 'http://username:password@host:8080';
var a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/'; let a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new Url.URL(mm); // Output 'http://username:password@host:8080/'; let b = new Url.URL(mm); // Output 'http://username:password@host:8080/';
new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1';
var c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; let c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1';
new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1
...@@ -443,7 +442,7 @@ Converts the parsed URL into a string. ...@@ -443,7 +442,7 @@ Converts the parsed URL into a string.
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString();
``` ```
...@@ -464,5 +463,5 @@ Converts the parsed URL into a JSON string. ...@@ -464,5 +463,5 @@ Converts the parsed URL into a JSON string.
**Example** **Example**
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON();
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册