diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index e70973d986d19ff05a92145cd7ec41e880521a6d..8b2851b629aaa7ef7efaec1f2753bb655dbd1b2f 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -1,18 +1,18 @@ # Context > **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. -> -> The APIs of this module can be used only in the FA module. +> +> 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. +> The APIs of this module can be used only in the FA model. ## Modules to Import ```js import featureAbility from '@ohos.ability.featureAbility' -import bundle from '@ohos.bundle' ``` +## Usage + The **Context** object is created in a **featureAbility** and returned through its **getContext()** API. Therefore, you must import the **@ohos.ability.featureAbility** package before using the Context module. An example is as follows: ```js @@ -33,9 +33,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** @@ -61,9 +61,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** @@ -87,11 +87,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** @@ -116,10 +116,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** @@ -139,16 +139,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** @@ -174,11 +174,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** @@ -210,9 +210,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** @@ -234,9 +234,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** @@ -261,9 +261,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** @@ -285,9 +285,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** @@ -312,9 +312,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** @@ -336,9 +336,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** @@ -365,9 +365,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** @@ -391,9 +391,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** @@ -416,9 +416,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** @@ -440,9 +440,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** @@ -467,9 +467,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** @@ -491,9 +491,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** @@ -516,9 +516,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** @@ -544,9 +544,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** @@ -569,9 +569,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** @@ -597,9 +597,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** @@ -624,9 +624,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** @@ -654,9 +654,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** @@ -678,9 +678,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** @@ -706,9 +706,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** @@ -730,9 +730,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** @@ -758,9 +758,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** @@ -782,9 +782,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** @@ -810,9 +810,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** @@ -834,9 +834,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** @@ -862,9 +862,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** @@ -886,9 +886,9 @@ Obtains the context of the application. **Return value** -| Type | Description | +| Type | Description | | --------- |------ | -| Context |Application context. | +| Context | Application context.| **Example** @@ -901,48 +901,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 | Running modes supported by the module. | +| reqCapabilities | Array\ | Yes | No | Capabilities required for module running.| +| deviceTypes | Array\ | Yes | No | Device types supported by the module.| +| abilityInfo | Array\ | Yes | No | Ability information. | +| moduleName | string | Yes | No | Module name. | +| mainAbilityName | string | Yes | No | Name of the main ability. | +| installationFree | boolean | Yes | No | Whether installation-free is supported. | +| mainElementName | string | Yes| No| Information about the main 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. | diff --git a/en/application-dev/reference/apis/js-apis-DataUriUtils.md b/en/application-dev/reference/apis/js-apis-DataUriUtils.md index ceac4f5d700a69d0fd41585ca6ab2efc4f4ea3fe..584b7e1285c0087bc1109bd32d50eb1143360df1 100644 --- a/en/application-dev/reference/apis/js-apis-DataUriUtils.md +++ b/en/application-dev/reference/apis/js-apis-DataUriUtils.md @@ -1,7 +1,7 @@ -# DataUriUtils +# DataUriUtils Module > **NOTE** -> +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -20,15 +20,15 @@ Obtains the ID attached to the end of a given URI. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | --------------------------- | -| uri | string | Yes | URI object from which the ID is to be obtained. | +| uri | string | Yes | URI object from which the ID is to be obtained.| **Return value** -| Type | Description | +| Type | Description | | ------ | ------------------------ | -| number | ID obtained from the URI object. | +| number | ID obtained from the URI object.| **Example** @@ -48,16 +48,16 @@ Attaches an ID to the end of a given URI. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | --------------------------- | -| uri | string | Yes | URI object to which an ID is to be attached. | -| id | number | Yes | ID to be attached. | +| uri | string | Yes | URI object to which an ID is to be attached.| +| id | number | Yes | ID to be attached. | **Return value** -| Type | Description | +| Type | Description | | ------ | --------------------- | -| string | URI object with the ID attached. | +| string | URI object with the ID attached.| **Example** @@ -81,15 +81,15 @@ Deletes the ID from the end of a given URI. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | --------------------------- | -| uri | string | Yes | URI object from which the ID is to be deleted. | +| uri | string | Yes | URI object from which the ID is to be deleted.| **Return value** -| Type | Description | +| Type | Description | | ------ | ------------------- | -| string | URI object with the ID deleted. | +| string | URI object with the ID deleted.| **Example** @@ -109,16 +109,16 @@ Updates the ID in a given URI. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ------------------- | -| uri | string | Yes | URI object to be updated. | -| id | number | Yes | New ID. | +| uri | string | Yes | URI object to be updated.| +| id | number | Yes | New ID. | **Return value** -| Type | Description | +| Type | Description | | ------ | --------------- | -| string | URI object with the new ID. | +| string | URI object with the new ID.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index cd2aa03316a50c658e7e9b2c5b7725ac368201c9..5350e678e940fbaef3f97de36fc5e3d3c46ec008 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -1,12 +1,10 @@ # AbilityContext > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. - Implements the ability context. This module is inherited from **Context**. ## Modules to Import @@ -14,10 +12,8 @@ Implements the ability context. This module is inherited from **Context**. ```js import Ability from '@ohos.application.Ability' ``` - ## Usage - Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**. ```js @@ -34,7 +30,7 @@ class MainAbility extends Ability { **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | abilityInfo | AbilityInfo | Yes| No| Ability information.| | currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| @@ -50,7 +46,7 @@ Starts an ability. This API uses a callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| @@ -79,7 +75,7 @@ Starts an ability. This API uses a callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | Yes| Parameters used for starting the ability.| @@ -112,14 +108,14 @@ Starts an ability. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | No| Parameters used for starting the ability.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result.| @@ -147,13 +143,13 @@ Starts an ability. This API uses a promise to return the result. startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -Starts an ability. This API uses a callback to return the execution result when the ability is terminated. +Starts an ability. This API uses a callback to return the result when the ability is terminated. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| @@ -175,13 +171,13 @@ Starts an ability. This API uses a callback to return the execution result when startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; -Starts an ability. This API uses a callback to return the execution result when the ability is terminated. +Starts an ability. This API uses a callback to return the result when the ability is terminated. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | Yes| Parameters used for starting the ability.| @@ -208,13 +204,13 @@ Starts an ability. This API uses a callback to return the execution result when startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; -Starts an ability. This API uses a promise to return the execution result when the ability is terminated. +Starts an ability. This API uses a promise to return the result when the ability is terminated. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | No| Parameters used for starting the ability.| @@ -222,7 +218,7 @@ Starts an ability. This API uses a promise to return the execution result when t **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Promise used to return the result.| @@ -250,7 +246,7 @@ Terminates this ability. This API uses a callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.| @@ -273,7 +269,7 @@ Terminates this ability. This API uses a promise to return the result. **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| @@ -298,7 +294,7 @@ Terminates this ability. This API uses a callback to return the information to t **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| @@ -327,13 +323,13 @@ Terminates this ability. This API uses a promise to return information to the ca **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result.| @@ -361,18 +357,18 @@ Obtains the caller interface of the specified ability, and if the specified abil **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<Caller> | Promise used to return the caller object to communicate with.| **Example** - + ```js import Ability from '@ohos.application.Ability'; var caller; @@ -403,13 +399,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | permissions | Array<string> | Yes| Permissions to request.| | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the API is successfully called.| -**Example** - +**Example** + ```js var permissions=['com.example.permission'] this.context.requestPermissionsFromUser(permissions,(result) => { @@ -429,18 +425,18 @@ Requests permissions from the user by displaying a pop-up window. This API uses **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | permissions | Array<string> | Yes| Permissions to request.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the API is successfully called.| -**Example** - +**Example** + ```js var permissions=['com.example.permission'] this.context.requestPermissionsFromUser(permissions).then((data) => { @@ -456,19 +452,19 @@ Requests permissions from the user by displaying a pop-up window. This API uses setMissionLabel(label: string, callback:AsyncCallback<void>): void; -Sets the label of the ability displayed in the task. This API uses a callback to return the result. +Sets the label of the ability in the mission. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | label | string | Yes| Label of the ability to set.| | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.| -**Example** - +**Example** + ```js this.context.setMissionLabel("test",(result) => { console.log('requestPermissionsFromUserresult:' + JSON.stringify(result)); @@ -480,24 +476,24 @@ Sets the label of the ability displayed in the task. This API uses a callback to setMissionLabel(label: string): Promise<void> -Sets the label of the ability displayed in the task. This API uses a promise to return the result. +Sets the label of the ability in the mission. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | label | string | Yes| Label of the ability to set.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| -**Example** - +**Example** + ```js this.context.setMissionLabel("test").then((data) => { console.log('success:' + JSON.stringify(data)); diff --git a/en/application-dev/reference/apis/js-apis-ability-errorCode.md b/en/application-dev/reference/apis/js-apis-ability-errorCode.md index d882c9b5ce0870438d9372a8470efcf5c5dad5b8..cc0197f022957aadb0dd784c1d4ae8c6e0c50005 100644 --- a/en/application-dev/reference/apis/js-apis-ability-errorCode.md +++ b/en/application-dev/reference/apis/js-apis-ability-errorCode.md @@ -1,9 +1,8 @@ # ErrorCode - -> **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. - +> **NOTE** +> +> The initial APIs of this module are supported since API 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -17,9 +16,9 @@ Defines the error code used when the ability is started. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Value | Description | +| Name | Value | Description | | ------------------------------ | ---- | ---------------------------------------- | -| NO_ERROR | 0 | No error occurs. | -| INVALID_PARAMETER | -1 | Invalid parameter. | -| ABILITY_NOT_FOUND | -2 | The ability is not found. | -| PERMISSION_DENY | -3 | Permission denied. | +| NO_ERROR | 0 | No error occurs. | +| INVALID_PARAMETER | -1 | Invalid parameter.| +| ABILITY_NOT_FOUND | -2 | The ability is not found.| +| PERMISSION_DENY | -3 | Permission denied. | diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 1190acad72e203ec1d42e7f2c4979938156bad50..e1d57d47b1b77f1695f8ec79ac49bfbb22422d05 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -1,17 +1,15 @@ # wantConstant - -> **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 ``` import wantConstant from '@ohos.ability.wantConstant' ``` - ## wantConstant.Action **System capability**: SystemCapability.Ability.AbilityBase @@ -20,32 +18,32 @@ Lists the permissions. | Common Event Macro | Common Event Name | Subscriber Permission | | ------------ | ------------------ | ---------------------- | -| ACTION_HOME | ohos.want.action.home | None | -| ACTION_DIAL | ohos.want.action.dial | None | -| ACTION_SEARCH | ohos.want.action.search | None | -| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None | -| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None | -| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | -| ACTION_SET_ALARM | ohos.want.action.setAlarm | None | -| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None | -| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None | -| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None | -| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None | -| ACTION_SEND_SMS | ohos.want.action.sendSms | None | -| ACTION_CHOOSE | ohos.want.action.choose | None | -| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | None | -| ACTION_VIDEO_CAPTUR8+ | ohos.want.action.videoCapture | None | -| ACTION_SELECT | ohos.want.action.select | None | -| ACTION_SEND_DATA | ohos.want.action.sendData | None | -| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None | -| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None | -| ACTION_VIEW_DATA | ohos.want.action.viewData | None | -| ACTION_EDIT_DATA | ohos.want.action.editData | None | -| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None | -| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None | -| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | None | -| PARAMS_STREAM7+ | ability.params.stream | None | -| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | None | +| ACTION_HOME | ohos.want.action.home | None | +| ACTION_DIAL | ohos.want.action.dial | None | +| ACTION_SEARCH | ohos.want.action.search | None | +| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None | +| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None | +| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | +| ACTION_SET_ALARM | ohos.want.action.setAlarm | None | +| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None | +| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None | +| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None | +| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None | +| ACTION_SEND_SMS | ohos.want.action.sendSms | None | +| ACTION_CHOOSE | ohos.want.action.choose | None | +| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | None | +| ACTION_VIDEO_CAPTUR8+ | ohos.want.action.videoCapture | None | +| ACTION_SELECT | ohos.want.action.select | None | +| ACTION_SEND_DATA | ohos.want.action.sendData | None | +| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None | +| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None | +| ACTION_VIEW_DATA | ohos.want.action.viewData | None | +| ACTION_EDIT_DATA | ohos.want.action.editData | None | +| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None | +| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None | +| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | None | +| PARAMS_STREAM7+ | ability.params.stream | None | +| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | None | ## wantConstant.Entity @@ -56,12 +54,12 @@ Lists the permissions. | Common Event Macro | Common Event Name | Subscriber Permission | | ------------ | ------------------ | ---------------------- | -| ENTITY_DEFAULT | entity.system.default | None | -| ENTITY_HOME | entity.system.homel | None | -| ENTITY_VOICE | ENTITY_VOICE | None | -| ENTITY_BROWSABLE | entity.system.browsable | None | -| ENTITY_VIDEO | entity.system.video | None | -| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | +| ENTITY_DEFAULT | entity.system.default | None | +| ENTITY_HOME | entity.system.homel | None | +| ENTITY_VOICE | ENTITY_VOICE | None | +| ENTITY_BROWSABLE | entity.system.browsable | None | +| ENTITY_VIDEO | entity.system.video | None | +| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None | ## flags @@ -70,19 +68,19 @@ Lists the permissions. | Name | Value | Description | | ------------------------------------ | ---------- | ------------------------------------------------------------ | -| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | -| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | -| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | -| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. | -| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | -| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. | -| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | -| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | -| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.| -| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | -| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. | -| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | -| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**. | -| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. | -| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists. | +| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | +| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | +| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | +| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. | +| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | +| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. | +| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | +| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | +| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. | +| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | +| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. | +| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | +| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| +| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. | +| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.| diff --git a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md index 65769dc7a2fbe62443957c415ca5c095e9473d52..a609e0df688e7a9cc5b32ea25907eda95ab14c47 100644 --- a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md +++ b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md @@ -1,6 +1,7 @@ # AbilityDelegatorRegistry -> **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. ## Modules to Import @@ -9,21 +10,19 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityLifecycleState Enumerates the ability lifecycle states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ------------- | ---- | --------------------------- | - | UNINITIALIZED | 0 | The ability is in an invalid state. | - | CREATE | 1 | The ability is created. | - | FOREGROUND | 2 | The ability is running in the foreground. | - | BACKGROUND | 3 | The ability is running in the background. | - | DESTROY | 4 | The ability is destroyed. | +| Name | Value | Description | +| ------------- | ---- | --------------------------- | +| UNINITIALIZED | 0 | The ability is in an invalid state. | +| CREATE | 1 | The ability is created.| +| FOREGROUND | 2 | The ability is running in the foreground. | +| BACKGROUND | 3 | The ability is running in the background. | +| DESTROY | 4 | The ability is destroyed.| @@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application. **Return value** - | Type | Description | - | ------------------------------------------------------------ | ------------------------------------------------------------ | - | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework. | +| Type | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework.| **Example** @@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application. **Return value** - | Type | Description | - | ------------------------------------------------------------ | ------------------------------------------------------------ | - | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters. | +| Type | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md index eb10aeecbacb98d0c045800ba0922fbc09fdf6dd..508463e3a428fffe336de4ae2c986623fb54d3b1 100644 --- a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md @@ -1,14 +1,13 @@ # AbilityRunningInfo > **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. Provides ability running information. ## Modules to Import - ```js import abilitymanager from '@ohos.application.abilityManager'; ``` @@ -28,14 +27,14 @@ abilitymanager.getAbilityRunningInfos((err,data) => { **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| ability | ElementName | Yes | No | Information that matches an ability. | -| pid | number | Yes | No | Process ID. | -| uid | number | Yes | No | User ID. | -| processName | string | Yes | No | Process name. | -| startTime | number | Yes | No | Ability start time. | -| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes | No | Ability state. | +| ability | ElementName | Yes| No| Information that matches an ability. | +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID. | +| processName | string | Yes| No| Process name. | +| startTime | number | Yes| No| Ability start time. | +| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. | ## abilityManager.AbilityState @@ -44,10 +43,10 @@ Enumerates the ability states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Value | Description | +| Name| Value| Description| | -------- | -------- | -------- | -| INITIAL | 0 | The ability is in the initial state. | -| FOREGROUND | 9 | The ability is in the foreground state. | -| BACKGROUND | 10 | The ability is in the background state. | -| FOREGROUNDING | 11 | The ability is in the foregrounding state. | -| BACKGROUNDING | 12 | The ability is in the backgrounding state. | +| INITIAL | 0 | The ability is in the initial state.| +| FOREGROUND | 9 | The ability is in the foreground state. | +| BACKGROUND | 10 | The ability is in the background state. | +| FOREGROUNDING | 11 | The ability is in the foregrounding state. | +| BACKGROUNDING | 12 | The ability is in the backgrounding state. | diff --git a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md index e3a7efd0dcbe8257a2eae6ddf30b4d4e0b35436e..65705aae3936cc2c9e9643f6142be6de6564124b 100644 --- a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md +++ b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md @@ -1,9 +1,9 @@ # AbilityStageContext > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md). @@ -15,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage'; ## Usage - The ability stage context is obtained through an **AbilityStage** instance. - - ```js import AbilityStage from '@ohos.application.AbilityStage'; class MyAbilityStage extends AbilityStage { @@ -29,12 +26,11 @@ class MyAbilityStage extends AbilityStage { } ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | Yes | No | **ModuleInfo** object corresponding to the **AbilityStage**. | -| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running. | +| currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.| +| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running.| diff --git a/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md b/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md index 1882e93e462df6ac24e2445af2d84ca8fc1d4662..c850915c4d2743d7ee8f03ce0b96d6a4f7739525 100644 --- a/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md +++ b/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md @@ -1,29 +1,24 @@ # MissionSnapshot - > **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. - Provides the snapshot of a mission. - ## Modules to Import - ``` import missionManager from '@ohos.application.missionManager' import ElementName from '@ohos.bundle'; import image from '@ohos.multimedia.image'; ``` - ## MissionSnapshot Describes the mission snapshot. -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| ability | ElementName | Yes | Yes | Information that matches an ability. | -| snapshot | [image.PixelMap](js-apis-image.md) | Yes| Yes| Snapshot of the mission. | +| ability | ElementName | Yes| Yes| Information that matches an ability.| +| snapshot | [image.PixelMap](js-apis-image.md) | Yes| Yes| Snapshot of the mission.| diff --git a/en/application-dev/reference/apis/js-apis-application-StartOptions.md b/en/application-dev/reference/apis/js-apis-application-StartOptions.md index b2a29f392acdac4b4e9bdfbdd1b31c7809671ce5..e221f4506244b56ea43e24ef916085ef1f3fac63 100644 --- a/en/application-dev/reference/apis/js-apis-application-StartOptions.md +++ b/en/application-dev/reference/apis/js-apis-application-StartOptions.md @@ -1,15 +1,14 @@ # StartOptions -> **NOTE**
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. **StartOptions** is the basic communication component of the system. - ## Modules to Import - ``` import StartOptions from '@ohos.application.StartOptions'; ``` @@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions'; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name | Readable | Writable | Type | Mandatory | Description | +| Name| Readable| Writable| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -------- | -------- | -| [windowMode](js-apis-window.md#windowmode) | Yes| No | number | No | Window mode. | -| displayId | Yes| No | number | No | Display ID. | +| [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.| +| displayId | Yes| No| number | No| Display ID.| diff --git a/en/application-dev/reference/apis/js-apis-application-Want.md b/en/application-dev/reference/apis/js-apis-application-Want.md index 19509a5e771ce744b16a8f231faf6f75bccb772b..26c0cd030bcdf36cee488cba5066b2beba38a3d3 100644 --- a/en/application-dev/reference/apis/js-apis-application-Want.md +++ b/en/application-dev/reference/apis/js-apis-application-Want.md @@ -1,14 +1,13 @@ # Want -> **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. **Want** is the basic communication component of the system. - ## Modules to Import - ``` import Want from '@ohos.application.Want'; ``` @@ -17,14 +16,15 @@ import Want from '@ohos.application.Want'; **System capability**: SystemCapability.Ability.AbilityBase - | Name | Readable/Writable | Type | Mandatory | Description | - | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | - | deviceId | Read only | string | No | ID of the device running the ability. | - | bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability. | - | abilityName | Read only | string | No | Name of the ability. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability. | - | uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**. | - | type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | - | flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags). | - | action | Read only | string | No | Action option. | - | parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. | - | entities | Read only | Array\ | No | List of entities. | +| Name | Readable/Writable| Type | Mandatory| Description | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| deviceId | Read only | string | No | ID of the device running the ability. | +| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.| +| abilityName | Read only | string | No | Name of the ability. If both **package** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.| +| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| +| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | +| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).| +| action | Read only | string | No | Action option. | +| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. | +| entities | Read only | Array\ | No | List of entities. | +| moduleName9+ | Read only | string | No | Module to which the ability belongs. Different abilities among HAP files in an application may use the same name. If the abilities cannot be distinguished by the combination of **bundleName** and **abilityName**, you can set **moduleName** for better distinguishing.| | diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md index cc21b752081b8dd32df0173c8e05b2a8df39b71c..90dd8b5216df6f91f82b7f4ba211b3d126ac3157 100644 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ b/en/application-dev/reference/apis/js-apis-application-ability.md @@ -1,18 +1,14 @@ # Ability > **NOTE** -> -> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> The APIs of this module can be used only in the stage model. - +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Manages the ability lifecycle and context. - ## Modules to Import - ``` import Ability from '@ohos.application.Ability'; ``` @@ -21,12 +17,13 @@ import Ability from '@ohos.application.Ability'; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [AbilityContext](js-apis-ability-context.md) | Yes | No | Context of an ability. | -| launchWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters for starting the ability. | -| lastRequestWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters used when the ability was started last time. | -| callee | [Callee](#callee) | Yes | No | Object that invokes the stub service. | +| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.| +| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.| +| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| +| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| + ## Ability.onCreate @@ -39,10 +36,10 @@ Called to initialize the service logic when an ability is created. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes | Information related to this ability, including the ability name and bundle name. | -| param | AbilityConstant.LaunchParam | Yes | Parameters for starting the ability, and the reason for the last abnormal exit. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.| + | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| **Example** @@ -65,9 +62,9 @@ Called when a **WindowStage** is created for this ability. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| windowStage | window.WindowStage | Yes | **WindowStage** information. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| **Example** @@ -109,9 +106,9 @@ Called when the **WindowStage** is restored during the migration of this ability **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| windowStage | window.WindowStage | Yes | **WindowStage** information. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| **Example** @@ -147,7 +144,7 @@ Called when this ability is destroyed to clear resources. onForeground(): void; -Called when this ability is running in the foreground. +Called when this ability is switched from the background to the foreground. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -166,7 +163,7 @@ Called when this ability is running in the foreground. onBackground(): void; -Callback when this ability is switched to the background. +Called when this ability is switched from the foreground to the background. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -191,15 +188,15 @@ Called to save data during the ability migration preparation process. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| wantParam | {[key: string]: any} | Yes | **want** parameter. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | wantParam | {[key: string]: any} | Yes| **want** parameter.| **Return value** -| Type | Description | -| -------- | -------- | -| AbilityConstant.OnContinueResult | Continuation result. | + | Type| Description| + | -------- | -------- | + | AbilityConstant.OnContinueResult | Continuation result.| **Example** @@ -225,9 +222,9 @@ Called when the ability startup mode is set to singleton. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| **Example** @@ -250,12 +247,12 @@ Called when the configuration of the environment where the ability is running is **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| config | [Configuration](js-apis-configuration.md) | Yes | New configuration. | - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.| +**Example** + ```js class myAbility extends Ability { onConfigurationUpdated(config) { @@ -268,18 +265,18 @@ Called when the configuration of the environment where the ability is running is dump(params: Array\): Array\; - Called when the client information is dumped. +Called when the client information is dumped. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| params | Array\ | Yes | Parameters in the form of a command. | - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | params | Array\ | Yes| Parameters in the form of a command.| +**Example** + ```js class myAbility extends Ability { dump(params) { @@ -306,16 +303,16 @@ Sends sequenceable data to the target ability. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. | -| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** -| Type | Description | -| -------- | -------- | -| Promise<void> | Promise used to return a response. | + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return a response.| **Example** @@ -379,16 +376,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. | -| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** -| Type | Description | -| -------- | -------- | -| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability. | + | Type| Description| + | -------- | -------- | + | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.| **Example** @@ -482,15 +479,15 @@ Releases the caller interface of the target ability. onRelease(callback: OnReleaseCallBack): void; -Registers a callback that is invoked when the Stub on the target ability is disconnected. +Registers a callback that is invoked when the stub on the target ability is disconnected. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.| **Example** @@ -523,7 +520,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc ## Callee -Implements callbacks for caller notification registration and unregistration. +Implements callbacks for caller notification registration and deregistration. ## Callee.on @@ -536,10 +533,10 @@ Registers a caller notification callback, which is invoked when the target abili **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| method | string | Yes | Notification message string negotiated between the two abilities. | -| callback | CaleeCallBack | Yes | JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities.| + | callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.| **Example** @@ -586,15 +583,15 @@ Registers a caller notification callback, which is invoked when the target abili off(method: string): void; -Unregisters a caller notification callback, which is invoked when the target ability registers a function. +Deregisters a caller notification callback, which is invoked when the target ability registers a function. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| method | string | Yes | Registered notification message string. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Registered notification message string.| **Example** @@ -615,10 +612,10 @@ Unregisters a caller notification callback, which is invoked when the target abi **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| (msg: string) | function | Yes | No | Prototype of the listener function interface registered by the caller. | - +| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.| + ## CaleeCallBack @@ -626,6 +623,6 @@ Unregisters a caller notification callback, which is invoked when the target abi **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes | No | Prototype of the message listener function interface registered by the callee. | +| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md index 1db280b4b8c111250cd1cb4230c5e665184cb0df..3b2a958f7f403cade73487d61ff3695e5935d1bb 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -1,28 +1,26 @@ # AbilityConstant -> **NOTE**
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Provides parameters related to ability launch. - ## Modules to Import - ```js import AbilityConstant from '@ohos.application.AbilityConstant'; ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | launchReason | LaunchReason | Yes | Yes | Ability launch reason. | - | lastExitReason | LastExitReason | Yes | Yes | Reason for the last exit. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| launchReason | LaunchReason| Yes| Yes| Ability launch reason.| +| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.| ## AbilityConstant.LaunchReason @@ -30,12 +28,12 @@ Enumerates ability launch reasons. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | UNKNOWN | 0 | Unknown reason. | - | START_ABILITY | 1 | Ability startup. | - | CALL | 2 | Call. | - | CONTINUATION | 3 | Ability continuation. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.| +| START_ABILITY | 1 | Ability startup.| +| CALL | 2 | Call.| +| CONTINUATION | 3 | Ability continuation.| ## AbilityConstant.LastExitReason @@ -44,11 +42,11 @@ Enumerates reasons for the last exit. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | UNKNOWN | 0 | Unknown reason. | - | ABILITY_NOT_RESPONDING | 1 | The ability does not respond. | - | NORMAL | 2 | Normal status. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.| +| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.| +| NORMAL | 2 | Normal status.| ## AbilityConstant.OnContinueResult @@ -57,8 +55,8 @@ Enumerates ability continuation results. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Value | Description | - | ----------------------------- | ---- | ------------------------------------------------------------ | - | AGREE | 0 | Continuation agreed. | - | REJECT | 1 | Continuation denied. | - | MISMATCH | 2 | Mismatch. | +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| AGREE | 0 | Continuation agreed.| +| REJECT | 1 | Continuation denied.| +| MISMATCH | 2 | Mismatch.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md index 2fcc67558f9430412f7ad6b0c03f2ae997ff9a14..ec8655be70c9037622328066aa63d2cc643421d1 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -1,7 +1,7 @@ # AbilityDelegator > **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. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityDelegator ### addAbilityMonitor9+ @@ -185,7 +183,7 @@ Waits for the ability that matches the **AbilityMonitor** instance to reach the | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| -| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the ability. | +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. | **Example** @@ -223,7 +221,7 @@ Waits a period of time for the ability that matches the **AbilityMonitor** insta | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| | timeout | number | Yes | Maximum waiting time, in milliseconds. | -| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the ability. | +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. | **Example** @@ -365,7 +363,7 @@ Obtains the top ability of the application. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------ | -| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the top ability.| +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md index 36a133137f300949b710e0f1e9d246528f0c25d3..ad43acc77bd9e7ff82b9d5bb7e01467e6b36c656 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md @@ -1,7 +1,7 @@ # AbilityDelegatorArgs > **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. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityDelegatorArgs Describes the test parameters. diff --git a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md index 9ac9b6868ec31a1b7e9f8b164491a6fec2e61997..02803ad07bcde72288958a9be4981a15b8b4b555 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md @@ -1,11 +1,19 @@ # AbilityLifecycleCallback -> **NOTE**
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context. +## Modules to Import + +```js +import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback"; +``` + ## AbilityLifecycleCallback.onAbilityCreate diff --git a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md index b31687b7edc2b3f6059d4f45fbf305c357d5a71b..e7f017b48ebb0f440b021386e7a427e2d0a59852 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md @@ -1,8 +1,8 @@ # AbilityMonitor > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -10,8 +10,6 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` - - ## AbilityMonitor Describes an ability monitor. diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md index 8e501a482e04e33a18a8040d0183257b7c3e90c4..731d21305f151cd0318b14813e270bc14a27a3d2 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md +++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md @@ -1,15 +1,14 @@ # AbilityStage -> **NOTE**
-> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - +> **NOTE** +> +> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads. - ## Modules to Import - ```js import AbilityStage from '@ohos.application.AbilityStage'; ``` @@ -22,8 +21,6 @@ Called when the application is created. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - - **Example** ```js @@ -45,15 +42,15 @@ Called when a specified ability is started. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start, such as the ability name and bundle name. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| **Return value** - | Type | Description | - | -------- | -------- | - | string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started. | + | Type| Description| + | -------- | -------- | + | string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.| **Example** @@ -77,9 +74,9 @@ Called when the global configuration is updated. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | config | [Configuration](js-apis-configuration.md) | Yes | Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.| **Example** @@ -92,10 +89,12 @@ Called when the global configuration is updated. ``` ## AbilityStage.context +context: AbilityStageContext; + Describes the configuration information about the context. **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name | Type | Description | - | ----------- | --------------------------- | ------------------------------------------------------------ | - | context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup. | +| Name | Type | Description | +| ----------- | --------------------------- | ------------------------------------------------------------ | +| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.| diff --git a/en/application-dev/reference/apis/js-apis-application-applicationContext.md b/en/application-dev/reference/apis/js-apis-application-applicationContext.md index 0dfc9de068ba3aef8c84594b18dcad2730034cf0..65ebdf8b7ed9151c554fc614bb3d7bde43494846 100644 --- a/en/application-dev/reference/apis/js-apis-application-applicationContext.md +++ b/en/application-dev/reference/apis/js-apis-application-applicationContext.md @@ -1,11 +1,17 @@ # ApplicationContext -> **NOTE**
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application. +## Modules to Import + +``` +import Ability from '@ohos.application.Ability'; +``` ## How to Use diff --git a/en/application-dev/reference/apis/js-apis-application-context.md b/en/application-dev/reference/apis/js-apis-application-context.md index b073c2b41c7bf5d23e1309b6bfd455d40f74b7da..cd0935b94a4ae0e08bc895a3a57e652efa7165c7 100644 --- a/en/application-dev/reference/apis/js-apis-application-context.md +++ b/en/application-dev/reference/apis/js-apis-application-context.md @@ -1,65 +1,62 @@ # Context > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. Provides the context for running code, including **applicationInfo** and **resourceManager**. ## Modules to Import - ``` import AbilityContext from '@ohos.application.Ability'; ``` ## Usage - You must extend **AbilityContext** to implement this module. - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Type | Readable | Writable | Description | + | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| resourceManager | ResourceManager | Yes | No | **ResourceManager** object. | -| applicationInfo | ApplicationInfo | Yes | No | Information about the application. | -| cacheDir | string | Yes | No | Cache directory of the application on the internal storage. | -| tempDir | string | Yes | No | Temporary file directory of the application. | -| filesDir | string | Yes | No | File directory of the application on the internal storage. | -| databaseDir | string | Yes | No | Storage directory of local data. | -| storageDir | string | Yes | No | Storage directory of lightweight data. | -| bundleCodeDir | string | Yes | No | Application installation path. | -| distributedFilesDir | string | Yes | No | Storage directory of distributed application data files. | -| eventHub | [EventHub](js-apis-eventhub.md) | Yes | No | Event hub information. | -| area | [AreaMode](#areamode) | Yes | Yes | Area in which the file to be access is located. | +| resourceManager | ResourceManager | Yes| No| **ResourceManager** object.| +| applicationInfo | ApplicationInfo | Yes| No| Information about the application.| +| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.| +| tempDir | string | Yes| No| Temporary file directory of the application.| +| filesDir | string | Yes| No| File directory of the application on the internal storage.| +| databaseDir | string | Yes| No| Storage directory of local data.| +| storageDir | string | Yes| No| Storage directory of lightweight data.| +| bundleCodeDir | string | Yes| No| Application installation path.| +| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.| +| eventHub | [EventHub](js-apis-eventhub.md) | Yes| No| Event hub information.| +| area | [AreaMode](#areamode) | Yes| Yes| Area in which the file to be access is located.| ## Context.createBundleContext createBundleContext(bundleName: string): Context; -Creates an application context. +Creates a context for a given application. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| bundleName | string | Yes | Application bundle name. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | bundleName | string | Yes| Application bundle name.| **Return value** -| Type | Description | -| -------- | -------- | -| Context | Context of the application created. | + | Type| Description| + | -------- | -------- | + | Context | Context created.| **Example** - + ```js import AbilityContext from '@ohos.application.Ability' class MainAbility extends AbilityContext { @@ -82,12 +79,12 @@ Obtains the context of this application. **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| ApplicationContext | Application context obtained. | +| ApplicationContext | Current application context.| **Example** - + ```js // This part is mandatory. let applicationContext = this.context.getApplicationContext(); @@ -96,11 +93,11 @@ Obtains the context of this application. ## AreaMode - Defines the area where the file to be access is located. Each area has its own content. +Defines the area where the file to be access is located. Each area has its own content. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Value | Description | +| Name | Value | Description | | --------------- | ---- | --------------- | -| EL1 | 0 | Device-level encryption area. | -| EL2 | 1 | User credential encryption area. The default value is **EL2**. | +| EL1 | 0 | Device-level encryption area. | +| EL2 | 1 | User credential encryption area. The default value is **EL2**.| diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md index 8371830fe05b7b9ab89973f5a9390160734547ef..05938521e10970192409f856e68b816c18d3f3f0 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-application-missionInfo.md @@ -1,6 +1,7 @@ # MissionInfo -> **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. ## Modules to Import @@ -9,7 +10,6 @@ import MissionInfo from '@ohos.application.missionInfo' ``` - ## MissionInfo Provides the mission information. diff --git a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md index 751ab23b122c6e039326349221cacdbd98208325..e0cddeee652418cdd714507cee826971fce73e28 100644 --- a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md +++ b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md @@ -1,7 +1,7 @@ # ShellCmdResult > **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. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md index 0a0a18ae37b50456db8c5e9d81ebceaaf675f18f..abd004e82d684fc3b038aebf8fb1153602137476 100644 --- a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @@ -1,9 +1,9 @@ # StaticSubscriberExtensionAbility - -> **NOTE**
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. ## Modules to Import ``` @@ -20,9 +20,9 @@ Callback of the common event of a static subscriber. **Parameters** - | Name | Type | Mandatory | Description | + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | event | CommonEventData | Yes | Callback of the common event of a static subscriber. | + | event | CommonEventData | Yes| Callback of the common event of a static subscriber.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md index a459f2d6ead9422bdf9e5172a202bda52c89d20e..236ed9c1af1231ebb1ddc8c63356a20f57cb3010 100644 --- a/en/application-dev/reference/apis/js-apis-appmanager.md +++ b/en/application-dev/reference/apis/js-apis-appmanager.md @@ -1,7 +1,7 @@ # appManager > **NOTE** -> +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -26,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -50,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -76,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -100,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -123,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** -| Type| Description| -| -------- | -------- | -| Promise<number> | Size of the application memory.| + | Type| Description| + | -------- | -------- | + | Promise<number> | Size of the application memory.| **Example** @@ -147,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | No| Size of the application memory.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<number> | No| Size of the application memory.| **Example** @@ -161,7 +161,7 @@ Obtains the memory size of this application. This API uses an asynchronous callb ``` ## appManager.getProcessRunningInfos8+ -getProcessRunningInfos(): Promise>; +getProcessRunningInfos(): Promise\>; Obtains information about the running processes. This API uses a promise to return the result. @@ -171,7 +171,7 @@ Obtains information about the running processes. This API uses a promise to retu | Type| Description| | -------- | -------- | -| Promise> | Promise used to return the process information.| +| Promise\> | Promise used to return the process information.| **Example** @@ -185,7 +185,7 @@ Obtains information about the running processes. This API uses a promise to retu ## appManager.getProcessRunningInfos8+ -getProcessRunningInfos(callback: AsyncCallback>): void; +getProcessRunningInfos(callback: AsyncCallback\>): void; Obtains information about the running processes. This API uses an asynchronous callback to return the result. @@ -195,7 +195,7 @@ Obtains information about the running processes. This API uses an asynchronous c | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback> | No| Callback used to return the process information.| +| callback | AsyncCallback\> | No| Callback used to return the process information.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-configuration.md b/en/application-dev/reference/apis/js-apis-configuration.md index 50803fb4587f9e8ec8e31f447a90eeccdd44780c..507b8a42448dd4ae892424feaae061c47d814138 100644 --- a/en/application-dev/reference/apis/js-apis-configuration.md +++ b/en/application-dev/reference/apis/js-apis-configuration.md @@ -1,20 +1,17 @@ # Configuration -> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. - Provides the configuration for the environment where the ability is running. - ## Modules to Import - ```js import Configuration from '@ohos.application.Configuration'; ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityBase diff --git a/en/application-dev/reference/apis/js-apis-configurationconstant.md b/en/application-dev/reference/apis/js-apis-configurationconstant.md index ef0917ba4a9d1838832d14117a2b002d9083f1f8..ebb78bc00e5ece7a6e04e64db6135f9d2f7ed7fd 100644 --- a/en/application-dev/reference/apis/js-apis-configurationconstant.md +++ b/en/application-dev/reference/apis/js-apis-configurationconstant.md @@ -1,6 +1,7 @@ # ConfigurationConstant -> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. @@ -17,7 +18,7 @@ import ConfigurationConstant from '@ohos.application.ConfigurationConstant'; ## ConfigurationConstant.ColorMode -The value is obtained through the **ConfigurationConstant.ColorMode** API. +You can obtain the value of this constant by calling the **ConfigurationConstant.ColorMode** API. **Example** @@ -36,7 +37,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT ## ConfigurationConstant.Direction9+ -The value is obtained through the **ConfigurationConstant.Direction** API. +You can obtain the value of this constant by calling the **ConfigurationConstant.Direction** API. **Example** @@ -55,7 +56,7 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL ## ConfigurationConstant.ScreenDensity9+ -The value is obtained through the **ConfigurationConstant.ScreenDensity** API. +You can obtain the value of this constant by calling the **ConfigurationConstant.ScreenDensity** API. **Example** diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md index e158249758e680683ece547a5f7758876edeebb5..df69b38be754f255ce637249c18a9d2fca5e13fd 100644 --- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -1,18 +1,25 @@ # DataAbilityHelper > **NOTE** -> -> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> The APIs of this module can be used only in the stage model. +> +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the FA model. ## Modules to Import ```js +import featureAbility from "@ohos.ability.featureAbility"; +``` + +## Usage + +Import the following modules based on the actual situation before using the current module: +``` import featureAbility from '@ohos.ability.featureAbility' import ohos_data_ability from '@ohos.data.dataAbility' import ohos_data_rdb from '@ohos.data.rdb' ``` + ## DataAbilityHelper.openFile openFile(uri: string, mode: string, callback: AsyncCallback\): void @@ -23,11 +30,11 @@ Opens a file with a specified URI. This API uses an asynchronous callback to ret **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------- | --------- | ---------------------------------------------------- | -| uri | string | Yes | URI of the file to open. | -| mode | string | Yes | Mode for opening the file. The value can be **rwt**. | -| callback | AsyncCallback\ | Yes | Callback used to return the file descriptor. | +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ---------------------------------- | +| uri | string | Yes | URI of the file to open. | +| mode | string | Yes | Mode for opening the file. The value can be **rwt**. | +| callback | AsyncCallback\ | Yes | Callback used to return the file descriptor.| **Example** @@ -566,7 +573,7 @@ Inserts multiple data records into the database. This API uses an asynchronous c | Name | Type | Mandatory| Description | | ------------ | ----------------------- | ---- | -------------------------------- | | uri | string | Yes | URI of the data to insert. | -| valuesBucket | Array | Yes | Data records to insert. | +| valuesBucket | Array\ | Yes | Data records to insert. | | callback | AsyncCallback\ | Yes | Callback used to return the number of inserted data records.| **Example** @@ -865,7 +872,7 @@ DAHelper.query( ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap): Promise +call(uri: string, method: string, arg: string, extras: PacMap): Promise\ Calls the extended API of the Data ability. This API uses a promise to return the result. @@ -884,7 +891,7 @@ Calls the extended API of the Data ability. This API uses a promise to return th | Type| Description| |------ | ------- | -|Promise<[PacMap](#pacmap)> | Promise used to return the result.| +|Promise\<[PacMap](#pacmap)> | Promise used to return the result.| **Example** @@ -901,7 +908,7 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", " ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void +call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\): void Calls the extended API of the Data ability. This API uses an asynchronous callback to return the result. @@ -915,7 +922,7 @@ Calls the extended API of the Data ability. This API uses an asynchronous callba | method | string | Yes | Name of the API to call. | | arg | string | Yes |Parameter to pass. | | extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. | -| callback | AsyncCallback<[PacMap](#pacmap)> | Yes| Callback used to return the result. | +| callback | AsyncCallback\<[PacMap](#pacmap)> | Yes| Callback used to return the result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-eventhub.md b/en/application-dev/reference/apis/js-apis-eventhub.md index b6dabe5f6dd613e55858cc20f49d68fecfc9fe6f..a5a25efdbab5c977e92b85a5fcc656f5c3ae3ef7 100644 --- a/en/application-dev/reference/apis/js-apis-eventhub.md +++ b/en/application-dev/reference/apis/js-apis-eventhub.md @@ -1,12 +1,10 @@ # EventHub > **NOTE** -> -> The initial APIs of this module are supported since API 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. - Implements event subscription, unsubscription, and triggering. ## Modules to Import @@ -17,8 +15,7 @@ import Ability from '@ohos.application.Ability' ## Usage - -Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance. +​Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance. ```js import Ability from '@ohos.application.Ability' @@ -43,10 +40,10 @@ Subscribes to an event. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| event | string | Yes | Event name. | -| callback | Function | Yes | Callback invoked when the event is triggered. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | event | string | Yes| Event name.| + | callback | Function | Yes| Callback invoked when the event is triggered.| **Example** @@ -81,10 +78,10 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| event | string | Yes | Event name. | -| callback | Function | No | Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | event | string | Yes| Event name.| + | callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.| **Example** @@ -119,10 +116,10 @@ Triggers an event. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| event | string | Yes | Event name. | -| ...args | Object[] | Yes | Variable parameters, which are passed to the callback when the event is triggered. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | event | string | Yes| Event name.| + | ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md index a43b67cf48ea2ea4f6217a99bf8a5d25af98ea2e..24ca2bb2e99bd5b308aea4683a9242c998417e78 100644 --- a/en/application-dev/reference/apis/js-apis-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-extension-context.md @@ -1,12 +1,10 @@ # ExtensionContext > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. - Implements the extension context. This module is inherited from **Context**. ## Modules to Import @@ -14,12 +12,11 @@ Implements the extension context. This module is inherited from **Context**. ```js import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility'; ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | Yes| No | Information about the current HAP. | -| config | Configuration | Yes| No | Module configuration information. | +| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP. | +| config | Configuration | Yes| No| Module configuration information.| diff --git a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md index 68c0c2b7bf914439fcedf77a0b4193909b092bc5..62f6d9b631aa687e61fc6a1b4fe26fb72f16f105 100644 --- a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md @@ -1,10 +1,9 @@ # ExtensionRunningInfo > **NOTE** -> +> > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - Provides extension running information. ## Modules to Import @@ -15,7 +14,6 @@ import abilitymanager from '@ohos.application.abilityManager'; ## Usage - The extension running information is obtained through an **abilityManager** instance. ```js @@ -48,15 +46,15 @@ Enumerates extension types. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name| Value| Description| + | Name| Value| Description| | -------- | -------- | -------- | -| FORM | 0 | Extension information of the form type.< | -| WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< | -| INPUT_METHOD | 2 | Extension information of the input method type.< | -| SERVICE | 3 | Extension information of the service type.< | -| ACCESSIBILITY | 4 | Extension information of the accessibility type.< | -| DATA_SHARE | 5 | Extension information of the data share type.< | -| FILE_SHARE | 6 | Extension information of the file share type.< | -| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type.< | -| WALLPAPER | 8 | Extension information of the wallpaper type.< | -| UNSPECIFIED | 9 | Extension information of the unspecified type.< | +| FORM | 0 | Extension information of the form type.< | +| WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< | +| INPUT_METHOD | 2 | Extension information of the input method type.< | +| SERVICE | 3 | Extension information of the service type.< | +| ACCESSIBILITY | 4 | Extension information of the accessibility type.< | +| DATA_SHARE | 5 | Extension information of the data share type.< | +| FILE_SHARE | 6 | Extension information of the file share type.< | +| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type.< | +| WALLPAPER | 8 | Extension information of the wallpaper type.< | +| UNSPECIFIED | 9 | Extension information of the unspecified type.< | diff --git a/en/application-dev/reference/apis/js-apis-featureAbility.md b/en/application-dev/reference/apis/js-apis-featureAbility.md index f4751909bed50248a55fe0145eeb1d3f0d384816..4c15fefc458a174ee0477d23b77aa9796f2bb051 100644 --- a/en/application-dev/reference/apis/js-apis-featureAbility.md +++ b/en/application-dev/reference/apis/js-apis-featureAbility.md @@ -1,12 +1,11 @@ # FeatureAbility > **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. -> +> +> 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. > The APIs of this module can be used only in the FA model. -## Usage +## Constraints APIs of the **FeatureAbility** module can be called only by Page abilities. @@ -47,7 +46,7 @@ featureAbility.startAbility( deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability name. */ - abilityName: "com.example.entry.secondAbility",, + abilityName: "com.example.entry.secondAbility", uri: "" }, }, @@ -921,13 +920,12 @@ Enumerates operation types of the Data ability. | ------------------- | ---- | -------------------- | ---- | -------------------------------------- | | want | Read-only | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start. | | abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.| - | ## flags **System capability**: SystemCapability.Ability.AbilityBase -| Name | Name | Description | +| Name | Value | Description | | ------------------------------------ | ---------- | ---------------------------------------- | | FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | | FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | diff --git a/en/application-dev/reference/apis/js-apis-formInfo.md b/en/application-dev/reference/apis/js-apis-formInfo.md index 1091770862af33647f271be1d0097859c7440ad1..502a8212f54e8cdefa381a8b862f1148e2f73b11 100644 --- a/en/application-dev/reference/apis/js-apis-formInfo.md +++ b/en/application-dev/reference/apis/js-apis-formInfo.md @@ -1,6 +1,7 @@ # FormInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. Provides widget information. diff --git a/en/application-dev/reference/apis/js-apis-formbindingdata.md b/en/application-dev/reference/apis/js-apis-formbindingdata.md index 2405a07b35e0ed01933bbe74dea8a29a9879011c..622f78b73e55afbe4fdcf8b342597b3ba44edeeb 100644 --- a/en/application-dev/reference/apis/js-apis-formbindingdata.md +++ b/en/application-dev/reference/apis/js-apis-formbindingdata.md @@ -1,7 +1,7 @@ # FormBindingData > **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. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-formerror.md b/en/application-dev/reference/apis/js-apis-formerror.md index 37eecd85304700c21d92e6f07d3cd11229a32c64..62e062c25eab28cfa018f4971da3e5317db7d448 100644 --- a/en/application-dev/reference/apis/js-apis-formerror.md +++ b/en/application-dev/reference/apis/js-apis-formerror.md @@ -1,6 +1,7 @@ # FormError -> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. Provides widget-related error codes. diff --git a/en/application-dev/reference/apis/js-apis-formextension.md b/en/application-dev/reference/apis/js-apis-formextension.md index 556cd0899d47436654c6778b379ec931682781c4..b758b2f8e46d2bc4df93d94546f36c0caff4c960 100644 --- a/en/application-dev/reference/apis/js-apis-formextension.md +++ b/en/application-dev/reference/apis/js-apis-formextension.md @@ -1,9 +1,8 @@ # FormExtension > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. Provides **FormExtension** APIs. @@ -24,7 +23,7 @@ None | Name | Type | Readable| Writable| Description | | ------- | ------------------------------------------------------- | ---- | ---- | --------------------------------------------------- | -| context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This class is inherited from **ExtensionContext**.| +| context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This context is inherited from **ExtensionContext**.| ## onCreate @@ -36,15 +35,15 @@ Called to notify the widget provider that a **Form** instance (widget) has been **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------------------------------------- | ---- | ------------------------------------------------------------ | -| want | [Want](js-apis-application-Want.md) | Yes | Information related to the extension, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.| + | Name| Type | Mandatory| Description | + | ------ | -------------------------------------- | ---- | ------------------------------------------------------------ | + | want | [Want](js-apis-application-Want.md) | Yes | Information related to the extension, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.| **Return value** -| Type | Description | -| ------------------------------------------------------------ | ----------------------------------------------------------- | -| [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | A **formBindingData.FormBindingData** object containing the data to be displayed on the widget.| + | Type | Description | + | ------------------------------------------------------------ | ----------------------------------------------------------- | + | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | A **formBindingData.FormBindingData** object containing the data to be displayed on the widget.| **Example** @@ -73,9 +72,9 @@ Called to notify the widget provider that a temporary widget has been converted **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| formId | string | Yes | ID of the widget that requests to be converted to a normal one.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | formId | string | Yes | ID of the widget that requests to be converted to a normal one.| **Example** @@ -97,9 +96,9 @@ Called to notify the widget provider that a widget has been updated. After obtai **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| formId | string | Yes | ID of the widget that requests to be updated.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | formId | string | Yes | ID of the widget that requests to be updated.| **Example** @@ -128,9 +127,9 @@ Called to notify the widget provider of the change of visibility. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------------------------- | ---- | ---------------------------- | -| newStatus | { [key: string]: number } | Yes | ID and visibility status of the widget to be changed.| + | Name | Type | Mandatory| Description | + | --------- | ------------------------- | ---- | ---------------------------- | + | newStatus | { [key: string]: number } | Yes | ID and visibility status of the widget to be changed.| **Example** @@ -163,10 +162,10 @@ Called to instruct the widget provider to receive and process the widget event. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ---------------------- | -| formId | string | Yes | ID of the widget that requests the event.| -| message | string | Yes | Event message. | + | Name | Type | Mandatory| Description | + | ------- | ------ | ---- | ---------------------- | + | formId | string | Yes | ID of the widget that requests the event.| + | message | string | Yes | Event message. | **Example** @@ -188,9 +187,9 @@ Called to notify the widget provider that a **Form** instance (widget) has been **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| formId | string | Yes | ID of the widget to be destroyed.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | formId | string | Yes | ID of the widget to be destroyed.| **Example** @@ -212,12 +211,12 @@ Called when the configuration of the environment where the ability is running is **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [Configuration](#section188911144124715) | Yes| New configuration.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [Configuration](#section188911144124715) | Yes| New configuration.| +**Example** + ```js class MyFormExtension extends FormExtension { onConfigurationUpdated(config) { @@ -236,12 +235,12 @@ Called when the widget provider receives the status query result of a specified **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | No | Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension. | - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | No| Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension.| +**Example** + ```js import fromInfo from '@ohos.application.fromInfo' class MyFormExtension extends FormExtension { @@ -250,4 +249,4 @@ Called when the widget provider receives the status query result of a specified return fromInfo.FormState.UNKNOWN; } } - ``` \ No newline at end of file + ``` diff --git a/en/application-dev/reference/apis/js-apis-formextensioncontext.md b/en/application-dev/reference/apis/js-apis-formextensioncontext.md index 6586152194aae73c75be480020cd4e7769a77484..4e877102c65aaf630ee5d5e12eff7d3c9e611b42 100644 --- a/en/application-dev/reference/apis/js-apis-formextensioncontext.md +++ b/en/application-dev/reference/apis/js-apis-formextensioncontext.md @@ -1,9 +1,8 @@ # FormExtensionContext > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**. @@ -24,11 +23,11 @@ Updates a widget. This method uses a callback to return the result. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- | -| formId | string | Yes | ID of the widget that requests to be updated. | -| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | -| callback | AsyncCallback\ | Yes | Callback used to return the result indicating whether the method is successfully called.| + | Name | Type | Mandatory| Description | + | --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- | + | formId | string | Yes | ID of the widget that requests to be updated. | + | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | + | callback | AsyncCallback\ | Yes | Callback used to return the result indicating whether the method is successfully called.| **Example** @@ -57,16 +56,16 @@ Updates a widget. This method uses a promise to return the result. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------------------------------------------------------ | ---- | ------------------ | -| formId | string | Yes | ID of the widget that requests to be updated.| -| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | + | Name | Type | Mandatory| Description | + | --------------- | ------------------------------------------------------------ | ---- | ------------------ | + | formId | string | Yes | ID of the widget that requests to be updated.| + | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | **Return value** -| Type | Description | -| -------------- | --------------------------------- | -| Promise\ | Promise returned with the result indicating whether the method is successfully called.| + | Type | Description | + | -------------- | --------------------------------- | + | Promise\ | Promise returned with the result indicating whether the method is successfully called.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-formhost.md b/en/application-dev/reference/apis/js-apis-formhost.md index 8301d7fb336ab740e591be81d5a4b4193b06412b..f85aab4c13153b43e853d6a5c2f47621917ef765 100644 --- a/en/application-dev/reference/apis/js-apis-formhost.md +++ b/en/application-dev/reference/apis/js-apis-formhost.md @@ -1,7 +1,7 @@ # FormHost > **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. Provides APIs related to the widget host. @@ -58,15 +58,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Parameters** @@ -148,16 +148,16 @@ SystemCapability.Ability.Form **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ----------- | -| formId | string | Yes | ID of a widget. | -| isReleaseCache | boolean | No | Whether to release the cache.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ----------- | + | formId | string | Yes | ID of a widget. | + | isReleaseCache | boolean | No | Whether to release the cache.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -210,15 +210,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -271,15 +271,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -338,9 +338,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -399,9 +399,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -460,9 +460,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -521,9 +521,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -575,9 +575,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -602,9 +602,9 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -622,6 +622,7 @@ SystemCapability.Ability.Form getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>; + Obtains the widget information provided by all applications on the device. This API uses a promise to return the result. **System capability** @@ -648,6 +649,7 @@ SystemCapability.Ability.Form getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; + Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. **System capability** @@ -656,10 +658,10 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -677,6 +679,7 @@ SystemCapability.Ability.Form getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; + Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. **System capability** @@ -685,11 +688,11 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| moduleName | string | Yes| Module name.| -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | moduleName | string | Yes| Module name.| + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -707,6 +710,7 @@ SystemCapability.Ability.Form getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>; + Obtains the widget information provided by a given application on the device. This API uses a promise to return the result. **System capability** @@ -715,10 +719,10 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| moduleName | string | No| Module name.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | moduleName | string | No| Module name.| **Return value** @@ -963,16 +967,16 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formIds | Array<string> | Yes | List of widget IDs.| -| isVisible | boolean | Yes | Whether to be visible.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formIds | Array<string> | Yes | List of widget IDs.| + | isVisible | boolean | Yes | Whether to be visible.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -1026,16 +1030,16 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formIds | Array<string> | Yes | List of widget IDs.| -| isEnableUpdate | boolean | Yes | Whether to enable update.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formIds | Array<string> | Yes | List of widget IDs.| + | isEnableUpdate | boolean | Yes | Whether to enable update.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md index 40367d50bcec160ec9d2bf932f3d8c6275a86d5f..9451ff77cf97d17c0925ed0a219f22fb430ec142 100644 --- a/en/application-dev/reference/apis/js-apis-formprovider.md +++ b/en/application-dev/reference/apis/js-apis-formprovider.md @@ -1,6 +1,7 @@ # FormProvider -> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. Provides APIs related to the widget provider. @@ -27,19 +28,19 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------------------------------------- | - | formId | string | Yes | ID of a widget. | - | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------- | +| formId | string | Yes | ID of a widget. | +| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** ```js var formId = "12400633174999288"; formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { - if (error) { - console.log('formProvider setFormNextRefreshTime, error:' + error.code); + if (error.code) { + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); } }); ``` @@ -56,22 +57,24 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------------------------------------- | - | formId | string | Yes | ID of a widget. | - | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------- | +| formId | string | Yes | ID of a widget. | +| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | **Return value** - | Type | Description | - | ------------- | ---------------------------------- | - | Promise\ |Promise used to return the result. | +| Type | Description | +| ------------- | ---------------------------------- | +| Promise\ |Promise used to return the result. | **Example** ```js var formId = "12400633174999288"; - formProvider.setFormNextRefreshTime(formId, 5).catch((error) => { + formProvider.setFormNextRefreshTime(formId, 5).then(() => { + console.log('formProvider setFormNextRefreshTime success'); + }).catch((error) => { console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); }); ``` @@ -88,11 +91,11 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | - | formId | string | Yes | ID of the widget to update.| - | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type | Mandatory| Description | +| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | +| formId | string | Yes | ID of the widget to update.| +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -101,15 +104,15 @@ SystemCapability.Ability.Form var formId = "12400633174999288"; let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); formProvider.updateForm(formId, obj, (error, data) => { - if (error) { - console.log('formProvider updateForm, error:' + error.code); + if (error.code) { + console.log('formProvider updateForm, error:' + JSON.stringify(error)); } }); ``` ## updateForm -updateForm(formId: string, formBindingData: FormBindingData): Promise<void>; +updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise<void>; Updates a widget. This API uses a promise to return the result. @@ -119,10 +122,10 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | - | formId | string | Yes | ID of the widget to update.| - | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | +| Name| Type | Mandatory| Description | +| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | +| formId | string | Yes | ID of the widget to update.| +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | **Return value** @@ -136,7 +139,9 @@ SystemCapability.Ability.Form import formBindingData from '@ohos.application.formBindingData'; var formId = "12400633174999288"; let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - formProvider.updateForm(formId, obj).catch((error) => { + formProvider.updateForm(formId, obj).then(() => { + console.log('formProvider updateForm success'); + }).catch((error) => { console.log('formProvider updateForm, error:' + JSON.stringify(error)); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-missionManager.md b/en/application-dev/reference/apis/js-apis-missionManager.md index 5ee9388c1e6196ae503dd5cb6f91213c588c3d22..b5e54a5b236a262143173c86932f5a6f45c11a85 100644 --- a/en/application-dev/reference/apis/js-apis-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-missionManager.md @@ -2,21 +2,18 @@ > **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. - missionManager provides APIs to lock, unlock, and clear missions, and switch a mission to the foreground. - ## Modules to Import - ``` import missionManager from '@ohos.application.missionManager' ``` -## Required Permissions +## Required Permissions ohos.permission.MANAGE_MISSIONS @@ -713,4 +710,4 @@ Describes the mission information. | want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.| | label | string | Yes| Yes| Label of the mission.| | iconPath | string | Yes| Yes| Path of the mission icon.| -| continuable | boolean | Yes| Yes| Whether the mission is continuable.| +| continuable | boolean | Yes| Yes| Whether the mission can be continued on another device. | diff --git a/en/application-dev/reference/apis/js-apis-particleAbility.md b/en/application-dev/reference/apis/js-apis-particleAbility.md index e07a8944cadf3233c040daba28f429f46adbafa1..12f2fd80bdd78b13c59b1684f080ac2798a9c436 100644 --- a/en/application-dev/reference/apis/js-apis-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-particleAbility.md @@ -1,12 +1,11 @@ # ParticleAbility > **NOTE** -> -> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> The APIs of this module can be used only in the FA module. +> +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the FA model. -## Usage +## Constraints The ParticleAbility module is used to perform operations on abilities of the Data and Service types. @@ -199,11 +198,11 @@ Requests a continuous task from the system. This API uses an asynchronous callba **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| id | number | Yes| Notification ID of a continuous task.| -| request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | id | number | Yes| Notification ID of a continuous task.| + | request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -263,16 +262,16 @@ Requests a continuous task from the system. This API uses a promise to return th **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| id | number | Yes | Notification ID of a continuous task. | -| request | NotificationRequest | Yes | Notification parameter, which is used to display information in the notification bar. | +| id | number | Yes| Notification ID of a continuous task.| +| request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.| **Return value** -| Type | Description | +| Type | Description | | -------------- | ------------------------- | -| Promise\ | Promise used to return the result. | +| Promise\ | Promise used to return the result.| **Example** @@ -326,9 +325,9 @@ Requests to cancel a continuous task from the system. This API uses an asynchron **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -357,9 +356,9 @@ Requests a continuous task from the system. This API uses a promise to return th **Return value** -| Type | Description | +| Type | Description | | -------------- | ------------------------- | -| Promise\ | Promise used to return the result. | +| Promise\ | Promise used to return the result.| **Example** @@ -385,21 +384,21 @@ Connects this ability to a specific Service ability. This API uses a callback to **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ------- | -------------- | ---- | ---------------------------- | -| request | [Want](js-apis-application-Want.md) | Yes | Service ability to connect. | -| options | ConnectOptions | Yes | Callback used to return the result. | +| request | [Want](js-apis-application-Want.md) | Yes | Service ability to connect.| +| options | ConnectOptions | Yes | Callback used to return the result. | -**ConnectOptions** +ConnectOptions **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Readable/Writable | Type | Mandatory | Description | +| Name | Readable/Writable| Type | Mandatory | Description | | ------------ | ---- | -------- | ---- | ------------------------- | -| onConnect | Read only | function | Yes | Callback invoked when the connection is successful. | -| onDisconnect | Read only | function | Yes | Callback invoked when the connection fails. | -| onFailed | Read only | function | Yes | Callback invoked when **connectAbility** fails to be called. | +| onConnect | Read only | function | Yes | Callback invoked when the connection is successful. | +| onDisconnect | Read only | function | Yes | Callback invoked when the connection fails. | +| onFailed | Read only | function | Yes | Callback invoked when **connectAbility** fails to be called.| **Example** @@ -446,9 +445,9 @@ Disconnects this ability from the Service ability. This API uses a callback to r **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -493,9 +492,9 @@ Disconnects this ability from the Service ability. This API uses a promise to re **Return value** -| Type | Description | +| Type | Description | | -------------- | ------------------------- | -| Promise\ | Promise used to return the result. | +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md index 1e4e5491471284db24e7a2733fd40d770a3a8915..f0d3ed2f0ce6e5e84883f38b7d9441b74dae5ae4 100644 --- a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -1,12 +1,10 @@ # PermissionRequestResult > **NOTE** -> +> > The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> > The APIs of this module can be used only in the stage model. - Provides the permission request result. ## Modules to Import @@ -15,9 +13,9 @@ Provides the permission request result. import Ability from '@ohos.application.Ability' ``` -## Usage +## How to Use - The permission request result is obtained through an **AbilityStage** instance. +The permission request result is obtained through an **AbilityStage** instance. ```js import Ability from '@ohos.application.Ability' @@ -42,7 +40,7 @@ export default class MainAbility extends Ability { **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type| Readable| Writable| Description| + | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| permissions | Array<string> | Yes| No| Permissions requested.| -| authResults | Array<number> | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. | +| permissions | Array<string> | Yes| No| Permissions requested.| +| authResults | Array<number> | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. | diff --git a/en/application-dev/reference/apis/js-apis-processrunninginfo.md b/en/application-dev/reference/apis/js-apis-processrunninginfo.md index 167d216652325fa4f48f4aec5a1c9d923bd48ec4..24fb9f15a5427a450ea907bb296c43f3d3f55a91 100644 --- a/en/application-dev/reference/apis/js-apis-processrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-processrunninginfo.md @@ -1,10 +1,9 @@ # ProcessRunningInfo > **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. - Provides process running information. ## Modules to Import @@ -15,7 +14,6 @@ import appManager from '@ohos.application.appManager' ## Usage - The process running information is obtained through an **appManager** instance. ```js @@ -30,9 +28,9 @@ appManager.getProcessRunningInfos((error,data) => { **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type| Readable| Writable| Description| + | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| pid | number | Yes| No| Process ID.| -| uid | number | Yes| No| User ID.| -| processName | string | Yes| No| Process name.| -| bundleNames | Array<string> | Yes| No| Names of all bundles running in the process.| +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID.| +| processName | string | Yes| No| Process name.| +| bundleNames | Array<string> | Yes| No| Names of all bundles running in the process.| diff --git a/en/application-dev/reference/apis/js-apis-service-extension-ability.md b/en/application-dev/reference/apis/js-apis-service-extension-ability.md index b2bfc7a85941381a40ed099e759a8d007220a318..b66c29fe1834b589ee9ffd32eb598e5c53dc2e0a 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-ability.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -1,34 +1,29 @@ # ServiceExtensionAbility > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. - Provides APIs related to **ServiceExtension**. - ## Modules to Import ``` import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; ``` - ## Required Permissions None. - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.| +| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.| ## ServiceExtensionAbility.onCreate @@ -41,9 +36,9 @@ Called when an extension is created to initialize the service logic. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| **Example** @@ -85,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| -| startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| + | startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| **Example** @@ -111,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Return value** -| Type| Description| -| -------- | -------- | -| rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| + | Type| Description| + | -------- | -------- | + | rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| **Example** @@ -151,9 +146,9 @@ Called when the ability is disconnected. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-service-extension-context.md b/en/application-dev/reference/apis/js-apis-service-extension-context.md index b6997fa308a25b6056361edcf88fb1271bf854db..518167d562ba8801223e206ad5b35ea07ea94936 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-context.md @@ -1,12 +1,10 @@ # ServiceExtensionContext > **NOTE** -> -> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. - Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**. ## Modules to Import @@ -25,10 +23,10 @@ Starts an ability. This API uses a callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| -| callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| **Example** @@ -58,15 +56,15 @@ Starts an ability. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -100,9 +98,9 @@ Terminates this ability. This API uses a callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| **Example** @@ -130,9 +128,9 @@ Terminates this ability. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -161,16 +159,16 @@ Connects this ability to a Service ability. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| -| options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| + | options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| **Return value** -| Type| Description| -| -------- | -------- | -| number | A number, based on which the connection will be interrupted.| + | Type| Description| + | -------- | -------- | + | number | A number, based on which the connection will be interrupted.| **Example** @@ -198,10 +196,10 @@ Disconnects this ability from the Service ability. This API uses a callback to r **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| connection | number | Yes| Number returned after **connectAbility** is called.| -| callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | connection | number | Yes| Number returned after **connectAbility** is called.| + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| **Example** @@ -231,16 +229,16 @@ Disconnects this ability from the Service ability. This API uses a promise to re **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| connection | number | Yes| Number returned after **connectAbility** is called.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | connection | number | Yes| Number returned after **connectAbility** is called.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| - + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + **Example** ```js @@ -265,8 +263,8 @@ Defines the **ConnectOptions** data structure. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Description| +| Name| Description| | -------- | -------- | -| onConnect(elementName:ElementName, remote:IRemoteObject) | Called when this ability is connected to a Service ability.| -| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.| -| onFailed(code: number) | Called when the connection fails.| +| onConnect(elementName:ElementName, remote:IRemoteObject) | Called when this ability is connected to a Service ability.| +| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.| +| onFailed(code: number) | Called when the connection fails.| diff --git a/en/application-dev/reference/apis/js-apis-testRunner.md b/en/application-dev/reference/apis/js-apis-testRunner.md index 47f1dc8dad5189495c3ca2a74d6b72ea96fc6de1..717c8448a00518b777b882fa7a49d7aca4509e11 100644 --- a/en/application-dev/reference/apis/js-apis-testRunner.md +++ b/en/application-dev/reference/apis/js-apis-testRunner.md @@ -1,8 +1,8 @@ # TestRunner -> **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. +> **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. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md index 0de14d40bd00dc6ec5fe8f6c0953e36401e7cd7c..6bbf0f941909786361f651546a3fab9fe129c69c 100644 --- a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md +++ b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md @@ -1,7 +1,7 @@ # uriPermissionManager > **NOTE** -> +> > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -28,12 +28,12 @@ SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. | -| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. | -| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. | -| callback | AsyncCallback<number> | Yes | Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| + | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| + | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| + | callback | AsyncCallback<number> | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| **Example** @@ -51,7 +51,7 @@ SystemCapability.Ability.AbilityRuntime.Core verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number> -Checks whether an application has the permission specified by **flag** for an URI. This API uses a promise to return the result. +Checks whether an application has the permission specified by **flag** for an URI. This API uses a callback to return the result. **System capability**: @@ -59,17 +59,17 @@ SystemCapability.Ability.AbilityRuntime.Core **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. | -| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. | -| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| + | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| + | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| **Return value** -| Type | Description | -| -------- | -------- | -| Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. | + | Type| Description| + | -------- | -------- | + | Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| **Example** @@ -83,4 +83,4 @@ SystemCapability.Ability.AbilityRuntime.Core }).catch((error) => { console.log('Verification failed.'); }) - ``` \ No newline at end of file + ``` diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index 971c27adb786b1341706c97a064b85a70a0d9a6a..c6a89b78715f1a819cd04a11f67a0609a98aa4f9 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -1,8 +1,8 @@ -# WantAgent Module +# WantAgent ->**NOTE** -> ->The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -756,7 +756,7 @@ var wantAgentInfo = { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) -//trigger callback +// trigger callback function triggerCallback(data) { console.info("==========================>triggerCallback=======================>"); } @@ -924,20 +924,20 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron **Parameters** -| Name | Readable | Writable | Type | Mandatory | Description | +| Name | Readable| Writable| Type | Mandatory| Description | | ---------- | --- | ---- | ------------------------ | ---- | --------------------------------------- | -| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | -| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the operation type. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the operation type.| **Example** ```js import WantAgent from '@ohos.wantAgent'; -//wantAgent���� +// WantAgent object var wantAgent; -//WantAgentInfo���� +// WantAgentInfo object var wantAgentInfo = { wants: [ { @@ -985,25 +985,25 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to **Parameters** -| Name | Readable | Writable | Type | Mandatory | Description | +| Name | Readable| Writable| Type | Mandatory| Description | | ---------- | --- | ---- | --------- | ---- | ------------- | -| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.| **Return value** -| Type | Description | -| ---------------- | ------------------------------------------ | -| Promise\ | Promise used to return the operation type. | +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the operation type.| **Example** ```js import WantAgent from '@ohos.wantAgent'; -//wantAgent���� +// WantAgent object var wantAgent; -//WantAgentInfo���� +// WantAgentInfo object var wantAgentInfo = { wants: [ {