From 966c20b699d23c5a7e6270a106649469e85e8131 Mon Sep 17 00:00:00 2001 From: king_he <6384784@qq.com> Date: Fri, 20 May 2022 03:06:29 +0000 Subject: [PATCH] update en/application-dev/reference/apis/js-apis-Context.md. Signed-off-by: king_he <6384784@qq.com> --- .../reference/apis/js-apis-Context.md | 208 +++++++++--------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index bc7b0afa88..62ab1faf7e 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -1,6 +1,6 @@ # Context Module -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -30,9 +30,9 @@ If this API is called for the first time, a root directory will be created. **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | -------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the local root directory.| +| callback | AsyncCallback\ | Yes | Callback used to return the local root directory. | **Example** @@ -58,9 +58,9 @@ If this API is called for the first time, a root directory will be created. **Return value** -| Type | Description | +| Type | Description | | ---------------- | ---------------------- | -| Promise\ | Promise used to return the local root directory.| +| Promise\ | Promise used to return the local root directory. | **Example** @@ -84,11 +84,11 @@ Verifies whether a specific PID and UID have the given permission. This API uses **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | ---------- | --------------------------------------- | ---- | ------------------------------------- | -| permission | string | Yes | Name of the permission to verify. | -| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. | -| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| +| permission | string | Yes | Name of the permission to verify. | +| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. | +| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission. | **Example** @@ -113,10 +113,10 @@ Verifies whether the current PID and UID have the given permission. This API use **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | ---------- | ---------------------- | ---- | ------------------------------------- | -| permission | string | Yes | Name of the permission to verify. | -| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| +| permission | string | Yes | Name of the permission to verify. | +| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission. | **Example** @@ -136,16 +136,16 @@ Verifies whether a specific PID and UID have the given permission. This API uses **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | ---------- | --------------------------------------- | ---- | ---------------- | -| permission | string | Yes | Name of the permission to verify.| -| options | [PermissionOptions](#permissionoptions) | No | Permission options. | +| permission | string | Yes | Name of the permission to verify. | +| options | [PermissionOptions](#permissionoptions) | No | Permission options. | **Return value** -| Type | Description | +| Type | Description | | ---------------- | ----------------------------------------------------------- | -| Promise\ | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| +| Promise\ | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission. | **Example** @@ -171,11 +171,11 @@ Requests certain permissions from the system. This API uses an asynchronous call **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- | -| permissions | Array\ | Yes | Permissions to request. This parameter cannot be **null**. | -| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.| -| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. | +| permissions | Array\ | Yes | Permissions to request. This parameter cannot be **null**. | +| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**. | +| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. | **Example** @@ -207,9 +207,9 @@ Obtains information about the current application. This API uses an asynchronous **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | ------------------------ | -| callback | AsyncCallback\ | Yes | Callback used to return the application information.| +| callback | AsyncCallback\ | Yes | Callback used to return the application information. | **Example** @@ -231,9 +231,9 @@ Obtains information about the current application. This API uses a promise to re **Return value** -| Type | Description | +| Type | Description | | ------------------------- | ------------------ | -| Promise\ | Promise used to return the application information.| +| Promise\ | Promise used to return the application information. | **Example** @@ -258,9 +258,9 @@ Obtains the bundle name of the current ability. This API uses an asynchronous ca **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ----------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| +| callback | AsyncCallback\ | Yes | Callback used to return the bundle name. | **Example** @@ -282,9 +282,9 @@ Obtains the bundle name of the current ability. This API uses a promise to retur **Return value** -| Type | Description | +| Type | Description | | ---------------- | ------------------------- | -| Promise\ | Promise used to return the bundle name.| +| Promise\ | Promise used to return the bundle name. | **Example** @@ -309,9 +309,9 @@ Obtains information about the current process, including the PID and process nam **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | --------------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the process information.| +| callback | AsyncCallback\ | Yes | Callback used to return the process information. | **Example** @@ -333,9 +333,9 @@ Obtains information about the current process, including the PID and process nam **Return value** -| Type | Description | +| Type | Description | | --------------------- | -------------- | -| Promise\ | Promise used to return the process information.| +| Promise\ | Promise used to return the process information. | **Example** @@ -362,9 +362,9 @@ This API is available only to Page abilities. **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | --------------------------- | ---- | ---------------------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the **ohos.bundle.ElementName** object.| +| callback | AsyncCallback\ | Yes | Callback used to return the **ohos.bundle.ElementName** object. | **Example** @@ -388,9 +388,9 @@ This API is available only to Page abilities. **Return value** -| Type | Description | +| Type | Description | | --------------------- | ------------------------------------------ | -| Promise\ | Promise used to return the **ohos.bundle.ElementName** object.| +| Promise\ | Promise used to return the **ohos.bundle.ElementName** object. | **Example** @@ -413,9 +413,9 @@ Obtains the name of the current process. This API uses an asynchronous callback **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the process name.| +| callback | AsyncCallback\ | Yes | Callback used to return the process name. | **Example** @@ -437,9 +437,9 @@ Obtains the name of the current process. This API uses a promise to return the r **Return value** -| Type | Description | +| Type | Description | | ---------------- | -------------------- | -| Promise\ | Promise used to return the process name.| +| Promise\ | Promise used to return the process name. | **Example** @@ -464,9 +464,9 @@ Obtains the bundle name of the calling ability. This API uses an asynchronous ca **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| +| callback | AsyncCallback\ | Yes | Callback used to return the bundle name. | **Example** @@ -488,9 +488,9 @@ Obtains the bundle name of the calling ability. This API uses a promise to retur **Return value** -| Type | Description | +| Type | Description | | --------------- | ------------------------- | -| Promise\ | Promise used to return the bundle name.| +| Promise\ | Promise used to return the bundle name. | **Example** @@ -513,9 +513,9 @@ Obtains the cache directory of the application on the internal storage. This API **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the cache directory.| +| callback | AsyncCallback\ | Yes | Callback used to return the cache directory. | **Example** @@ -541,9 +541,9 @@ Obtains the cache directory of the application on the internal storage. This API **Return value** -| Type | Description | +| Type | Description | | --------------- | ------------------------- | -| Promise\ | Promise used to return the cache directory.| +| Promise\ | Promise used to return the cache directory. | **Example** @@ -566,9 +566,9 @@ Obtains the file directory of the application on the internal storage. This API **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the file directory.| +| callback | AsyncCallback\ | Yes | Callback used to return the file directory. | **Example** @@ -594,9 +594,9 @@ Obtains the file directory of the application on the internal storage. This API **Return value** -| Type | Description | +| Type | Description | | --------------- | ------------------------- | -| Promise\ | Promise used to return the file directory.| +| Promise\ | Promise used to return the file directory. | **Example** @@ -621,9 +621,9 @@ If the distributed file path does not exist, the system will create one and retu **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | 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\ | 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** @@ -651,9 +651,9 @@ If the distributed file path does not exist, the system will create one and retu **Return value** -| Type | Description | +| Type | Description | | --------------- | ------------------------- | -| Promise\ | Promise used to return the distributed file path. If this API is called for the first time, a new path will be created.| +| Promise\ | Promise used to return the distributed file path. If this API is called for the first time, a new path will be created. | **Example** @@ -675,9 +675,9 @@ Obtains the application type. This API uses an asynchronous callback to return t **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the application type.| +| callback | AsyncCallback\ | Yes | Callback used to return the application type. | **Example** @@ -703,9 +703,9 @@ Obtains the application type. This API uses a promise to return the result. **Return value** -| Type | Description | +| Type | Description | | --------------- | ------------------------- | -| Promise\ | Promise used to return the application type.| +| Promise\ | Promise used to return the application type. | **Example** @@ -727,9 +727,9 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron **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** @@ -755,9 +755,9 @@ Obtains the **ModuleInfo** object of the application. This API uses a promise to **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** @@ -779,9 +779,9 @@ Obtains the version information of the application. This API uses an asynchronou **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** @@ -807,9 +807,9 @@ Obtains the version information of the application. This API uses a promise to r **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** @@ -831,9 +831,9 @@ Obtains information of the current ability. This API uses an asynchronous callba **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** @@ -859,9 +859,9 @@ Obtains information of the current ability. This API uses a promise to return th **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** @@ -883,9 +883,9 @@ Obtains the context of the application. **Return value** -| Type | Description | +| Type | Description | | --------- |------ | -| Context |Application context.| +| Context |Application context. | **Example** @@ -898,48 +898,48 @@ var context = featureAbility.getContext().getApplicationContext(); **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.| -| uid | Read-only | number | No | User ID.| +| pid | Read-only | number | No | Process ID. | +| uid | Read-only | number | No | User ID. | ## PermissionRequestResult7+ **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.| -| permissions | Read-only | Array\ | Yes | Permissions requested. | -| authResults | Read-only | Array\ | Yes | Permission request result. | +| requestCode | Read-only | number | Yes | Request code passed. | +| permissions | Read-only | Array\ | Yes | Permissions requested. | +| authResults | Read-only | Array\ | Yes | Permission request result. | ## HapModuleInfo7+ Describes the HAP module information. -| Name | Type| Readable| Writable| Description| +| Name | Type| Readable | Writable | Description | | ------ | ------ | ------ | ------ | ------ | -| name | string | Yes | No | Module name. | -| description | string | Yes | No | Module description. | -| descriptionId | number | Yes | No | Module description ID. | -| icon | string | Yes | No | Module icon. | -| label | string | Yes | No | Module label. | -| labelId | number | Yes | No | Module label ID. | -| iconId | number | Yes | No | Module icon ID. | -| backgroundImg | string | Yes | No | Module background image. | -| supportedModes | number | Yes | No | Modes supported by the module. | -| reqCapabilities | Array | Yes | No | Capabilities required for module running.| -| deviceTypes | Array | Yes | No | An array of supported device types.| -| abilityInfo | Array | Yes | No | Ability information. | -| moduleName | string | Yes | No | Module name. | -| mainAbilityName | string | Yes | No | Name of the entrance ability. | -| installationFree | boolean | Yes | No | When installation-free is supported. | -| mainElementName | string | Yes| No| Information about the entry ability.| +| name | string | Yes | No | Module name. | +| description | string | Yes | No | Module description. | +| descriptionId | number | Yes | No | Module description ID. | +| icon | string | Yes | No | Module icon. | +| label | string | Yes | No | Module label. | +| labelId | number | Yes | No | Module label ID. | +| iconId | number | Yes | No | Module icon ID. | +| backgroundImg | string | Yes | No | Module background image. | +| supportedModes | number | Yes | No | Modes supported by the module. | +| reqCapabilities | Array | Yes | No | Capabilities required for module running. | +| deviceTypes | Array | Yes | No | An array of supported device types. | +| abilityInfo | Array | Yes | No | Ability information. | +| moduleName | string | Yes | No | Module name. | +| mainAbilityName | string | Yes | No | Name of the entrance ability. | +| installationFree | boolean | Yes | No | When installation-free is supported. | +| mainElementName | string | Yes| No| Information about the entry ability. | ## AppVersionInfo7+ -| Name | Type| Readable | Writable | Description| -| ------ | ------ | ------| ------ | ------ | -| appName | string | Yes | No | Module name. | -| versionCode | number | Yes | No | Module description. | -| versionName | string | Yes | No | Module description ID. | +| Name | Type| Readable | Writable | Description | +| ------ | ------ | ------| ------ | ------ | +| appName | string | Yes | No | Module name. | +| versionCode | number | Yes | No | Module description. | +| versionName | string | Yes | No | Module description ID. | -- GitLab