提交 ea72980d 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 8d874f4b
......@@ -6,24 +6,25 @@
import dataUriUtils from '@ohos.ability.dataUriUtils';
```
## DataUriUtils.getId
## dataUriUtils.getId
- Functionality
getId(uri: string): number
Obtains the ID attached to the end of a given URI.
Obtains the ID attached to the end of a given URI.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| ---- | -------- | ------ | ---- | ------------------------- |
| uri | Read-only| string | Yes| URI object from which the ID is to be obtained.|
| Name| Type| Mandatory| Description|
| ---- | ------ | ---- | --------------------------- |
| uri | string | Yes| URI object from which the ID is to be obtained.|
- Return values
**Return value**
| Type| Description|
| ------ | ------------------------ |
| number | ID obtained from the URI object.|
Returns the ID obtained from the URI object.
- Example
**Example**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
......@@ -32,25 +33,26 @@ dataUriUtils.getIdSync("com.example.dataUriUtils/1221")
## DataUriUtils.attachId
- Functionality
## dataUriUtils.attachId
Attaches an ID to the end of a given URI.
attachId(uri: string, id: number): string
- Parameters
Attaches an ID to the end of a given URI.
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| ---- | -------- | ------ | ---- | ------------------------- |
| uri | Read-only| string | Yes| URI object to which an ID is to be attached.|
| id | Read-only| number | Yes| ID to be attached.|
- Return values
| Name| Type| Mandatory| Description|
| ---- | ------ | ---- | --------------------------- |
| uri | string | Yes| URI object to which an ID is to be attached.|
| id | number | Yes| ID to be attached.|
Returns the URI object with the ID attached.
**Return value**
| Type| Description|
| ------ | --------------------- |
| string | URI object with the ID attached.|
- Example
**Example**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
......@@ -63,23 +65,24 @@ dataUriUtils.attachId(
## DataUriUtils.deleteId
## dataUriUtils.deleteId
- Functionality
deleteId(uri: string): string
Deletes the ID from the end of a given URI.
Deletes the ID from the end of a given URI.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| ---- | -------- | ------ | ---- | ------------------------- |
| uri | Read-only| string | Yes| URI object from which the ID is to be deleted.|
| Name| Type| Mandatory| Description|
| ---- | ------ | ---- | --------------------------- |
| uri | string | Yes| URI object from which the ID is to be deleted.|
- Return values
**Return value**
| Type| Description|
| ------ | ------------------- |
| string | URI object with the ID deleted.|
Returns the URI object with the ID deleted.
- Example
**Example**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
......@@ -88,24 +91,25 @@ dataUriUtils.deleteId("com.example.dataUriUtils/1221")
## DataUriUtils.updateId
- Functionality
## dataUriUtils.updateId
Updates the ID in a given URI.
updateId(uri: string, id: number): string
- Parameters
Updates the ID in a given URI.
| Name| Readable/Writable| Type| Mandatory| Description|
| ---- | -------- | ------ | ---- | ------------------- |
| uri | Read-only| string | Yes| URI object to be updated.|
| id | Read-only| number | Yes| New ID.|
**Parameters**
- Return values
| Name| Type| Mandatory| Description|
| ---- | ------ | ---- | ------------------- |
| uri | string | Yes| URI object to be updated.|
| id | number | Yes| New ID.|
Returns the URI object with the new ID.
**Return value**
| Type| Description|
| ------ | --------------- |
| string | URI object with the new ID.|
- Example
**Example**
```js
import dataUriUtils from '@ohos.ability.datauriutils'
......
......@@ -12,7 +12,7 @@ import faultLogger from '@ohos.faultLogger'
None
## faultLogger.FaultType
## FaultType
Enumerates the fault types.
......@@ -23,7 +23,7 @@ Enumerates the fault types.
| JS_CRASH | 3 | JS program crash.|
| APP_FREEZE | 4 | Application freezing.|
## faultLogger.FaultLogInfo
## FaultLogInfo
Defines the data structure of the fault log information.
......@@ -31,7 +31,7 @@ Defines the data structure of the fault log information.
| -------- | -------- | -------- |
| pid | number | Process ID of the faulty process.|
| uid | number | User ID of the faulty process.|
| type | [FaultType](#faultloggerfaulttype) | Fault type.|
| type | [FaultType](#faulttype) | Fault type.|
| timestamp | number | Second-level timestamp when the log was generated.|
| reason | string | Reason for the fault.|
| module | string | Module on which the fault occurred.|
......@@ -47,8 +47,8 @@ Obtains the fault information about the current process. This method uses a call
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faultloggerfaulttype) | Yes| Fault type.|
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloggerfaultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
- Example
```
......@@ -83,12 +83,12 @@ Obtains the fault information about the current process. This method uses a prom
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faultloggerfaulttype) | Yes| Fault type.|
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
- Return values
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloggerfaultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**. <br/>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
- Example
```
......
......@@ -10,25 +10,21 @@ The ParticleAbility module is used to perform operations on abilities of the Dat
import particleAbility from '@ohos.ability.particleAbility'
```
## particleAbility.startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<void>: void
## particleAbility.startAbility
- Functionality
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<void>: void
Starts a Service ability. This method uses a callback to return the result.
Starts a Service ability. This method uses a callback to return the result.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| --------- | -------- | ------------------------------------------------------- | ---- | ----------------- |
| parameter | Read-only| [StartAbilityParameter](#StartAbilityParameter)| Yes| Ability to start.|
| callback | Read-only| AsyncCallback\<void> | Yes| Callback used to return the result.|
- Return values
| Name| Type| Mandatory| Description|
| --------- | ----------------------------------------------- | ---- | ----------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
void
- Example
**Example**
```js
import particleAbility from '@ohos.ability.particleAbility'
......@@ -54,22 +50,23 @@ particleAbility.startAbility(
## particleAbility.startAbility(parameter: StartAbilityParameter): Promise\<number>
## particleAbility.startAbility
- Functionality
startAbility(parameter: StartAbilityParameter): Promise\<number>
Starts a Service ability. This method uses a promise to return the result.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| --------- | -------- | ------------------------------------------------------- | ---- | ----------------- |
| parameter | Read-only| [StartAbilityParameter](#StartAbilityParameter)| Yes| Ability to start.|
- Return values
Promise\<void>
| Name| Type| Mandatory| Description|
| --------- | ----------------------------------------------- | ---- | ----------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
**Return value**
| Type| Description|
| -------------- | ------------------------- |
| Promise\<void> | Promise returned with the result.|
- Example
**Example**
```js
import particleAbility from '@ohos.ability.particleAbility'
......@@ -94,23 +91,19 @@ particleAbility.startAbility(
## particleAbility.terminateSelf(callback: AsyncCallback\<void>): void
## particleAbility.terminateSelf
- Functionality
terminateSelf(callback: AsyncCallback\<void>): void
Terminates this Service ability. This method uses a callback to return the result.
Terminates this Service ability. This method uses a callback to return the result.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| -------- | -------- | -------------------- | ---- | -------------------- |
| callback | Read-only| AsyncCallback\<void> | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
- Return values
void
- Example
**Example**
```js
import particleAbility from '@ohos.ability.particleAbility'
......@@ -123,17 +116,18 @@ particleAbility.terminateSelf(
## particleAbility.terminateSelf(): Promise\<void>
- Functionality
## particleAbility.terminateSelf
Terminates this Service ability. This method uses a promise to return the result.
terminateSelf(): Promise\<void>
- Return values
Terminates this Service ability. This method uses a promise to return the result.
Promise\<void>
**Return value**
| Type| Description|
| -------------- | ------------------------- |
| Promise\<void> | Promise returned with the result.|
- Example
**Example**
```js
import particleAbility from '@ohos.ability.particleAbility'
......@@ -144,25 +138,25 @@ particleAbility.terminateSelf().then((void) => {
## particleAbility.acquireDataAbilityHelper(uri: string): DataAbilityHelper
## particleAbility.acquireDataAbilityHelper
- Functionality
acquireDataAbilityHelper(uri: string): DataAbilityHelper
Obtains a **dataAbilityHelper** object.
Obtains a **dataAbilityHelper** object.
- Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| :--- | -------- | ------ | ---- | ---------------------- |
| uri | Read-only| string | Yes| URI of the file to open.|
| Name| Type| Mandatory| Description|
| :--- | ------ | ---- | ------------------------ |
| uri | string | Yes| URI of the file to open.|
- Return values
**Return value**
| Type| Description|
| ----------------- | ------------------------------------------ |
| ----------------- | -------------------------------------------- |
| DataAbilityHelper | A utility class used to help other abilities access a Data ability.|
- Example
**Example**
```js
import particleAbility from '@ohos.ability.particleAbility'
......@@ -170,20 +164,20 @@ var uri = "";
particleAbility.acquireDataAbilityHelper(uri)
```
## particleAbility.connectAbility(request: Want, options:ConnectOptions): number
## particleAbility.connectAbility
* Functionality
connectAbility(request: Want, options:ConnectOptions): number
Connects this ability to a specific Service ability. This method uses a callback to return the result.
Connects this ability to a specific Service ability. This method uses a callback to return the result.
* Parameters
**Parameters**
| Name| Readable/Writable| Type| Mandatory| Description|
| ------- | -------- | -------------- | ---- | -------------------------- |
| request | Read-only| Want | Yes| Service ability to connect.|
| options | Read-only| ConnectOptions | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| ------- | -------------- | ---- | -------------------------- |
| request | [Want](#want) | Yes| Service ability to connect.|
| options | ConnectOptions | Yes| Callback used to return the result.|
- ConnectOptions
ConnectOptions
| Name| Readable/Writable| Type| Mandatory| Description|
| ------------ | -------- | -------- | ---- | ---------------------------------- |
......@@ -191,11 +185,12 @@ particleAbility.acquireDataAbilityHelper(uri)
| onDisconnect | Read-only| function | Yes| Callback invoked when the connection is interrupted.|
| onFailed | Read-only| function | Yes| Callback invoked when the connection fails.|
* Return values
Returns the unique identifier of the connection.
**Return value**
| Type| Description|
| ------ | -------------------------- |
| number | Unique identifier of the connection between the client and the service side.|
* Example
**Example**
```javascript
import particleAbility from '@ohos.ability.particleAbility'
......@@ -221,24 +216,20 @@ var connId = particleAbility.connectAbility(
);
```
## particleAbility.disconnectAbility(connection: number, callback:AsyncCallback\<void>): void
* Functionality
## particleAbility.disconnectAbility
Disconnects this ability from a specific Service ability. This method uses a callback to return the result.
disconnectAbility(connection: number, callback:AsyncCallback\<void>): void
* Parameters
Disconnects this ability from a specific Service ability. This method uses a callback to return the result.
| Name| Readable/Writable| Type| Mandatory| Description|
| ---------- | -------- | ------------- | ---- | ------------------------------ |
| connection | Read-only| number | Yes| ID of the Service ability to disconnect.|
| callback | Read-only| AsyncCallback\<void> | Yes| Callback used to return the result.|
* Return values
**Parameters**
void
| Name| Type| Mandatory| Description|
| ---------- | ------------- | ---- | ------------------------------ |
| connection | number | Yes| ID of the Service ability to disconnect.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
* Example
**Example**
```javascript
import particleAbility from '@ohos.ability.particleAbility'
......@@ -269,23 +260,24 @@ var result = particleAbility.disconnectAbility(connId,
);
```
## particleAbility.disconnectAbility(connection: number): Promise\<void>
* Functionality
## particleAbility.disconnectAbility
Disconnects this ability from a specific Service ability. This method uses a promise to return the result.
disconnectAbility(connection: number): Promise\<void>
* Parameters
Disconnects this ability from a specific Service ability. This method uses a promise to return the result.
| Name| Readable/Writable| Type| Mandatory| Description|
| ---------- | -------- | ------ | ---- | ------------------------------ |
| connection | Read-only| number | Yes| ID of the Service ability to disconnect.|
**Parameters**
* Return values
| Name| Type| Mandatory| Description|
| ---------- | ------ | ---- | ------------------------------ |
| connection | number | Yes| ID of the Service ability to disconnect.|
Promise\<void>
**Return value**
| Type| Description|
| -------------- | ------------------------- |
| Promise\<void> | Promise returned with the result.|
* Example
**Example**
```javascript
import particleAbility from '@ohos.ability.particleAbility'
......@@ -318,7 +310,7 @@ var result = particleAbility.disconnectAbility(connId).then((void) => {
| Name| Readable/Writable| Type| Mandatory| Description|
| ------------------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| want | Read-only| [Want](#Want)| Yes| Information about the ability to start.|
| want | Read-only| [Want](#want) | 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.|
## Want
......@@ -358,10 +350,10 @@ var result = particleAbility.disconnectAbility(connId).then((void) => {
## AbilityStartSetting
Defines special attributes of an ability, for example, **featureAbility.AbilityStartSetting.BOUNDS_KEY**.
The **AbilityStartSetting** attribute is an object defined as [key: string]: any. The key is a type of **AbilityStartSetting**, and the value is a type of **AbilityWindowConfiguration**.
Defines special attributes of an ability, for example, **featureAbility.AbilityStartSetting.BOUNDS_KEY**.
| Name| Value| Description|
| --------------- | --------------- | -------------------------- |
| BOUNDS_KEY | "abilityBounds" | Ability window size.|
......
......@@ -662,18 +662,18 @@ this.StartContinueAbility(remoteDeviceId); //remoteDeviceId is acquired from Dev
| ------------------------------------ | ---------- | ------------------------------------------------------------ |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | 指示对URI执行读取操作的授权 |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | 指示对URI执行写入操作的授权 |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 将结果返回给能力 |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 将结果返回给能力 |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | 确定是否可以将本地设备上的功能迁移到远程设备 |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | 指定组件是否属于OHOS |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | 指定是否启动某个能力 |
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | 指示URI上可能持久化的授权 |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 指示对URI前缀进行授权的权限 |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 按照前缀匹配的方式验证URI权限 |
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | 支持分布式调度系统中的多设备启动 |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | 指示无论主机应用程序是否已启动,都将启动使用服务模板的功能 |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 表示迁移是可拉回的。 |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | 如果未安装指定的功能,请安装该功能 |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 如果未安装,使用后台模式安装该功能。 |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 指示清除其他任务的操作。可以为传递给{@link ohos.app.Context#startAbility}的{@code Want}设置此标志,并且必须与{@link flag_ABILITY_NEW_MISSION}一起使用 |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 指示清除其他任务的操作。可以为传递给**ohos.app.Context#startAbility****Want**设置此标志,并且必须与**flag_ABILITY_NEW_MISSION**一起使用 |
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | 指示在历史任务堆栈上创建任务的操作。 |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | 指示如果启动能力的现有实例已位于任务堆栈的顶部,则将重用该实例。否则,将创建一个新的能力实例。 |
......@@ -333,12 +333,12 @@ var result = particleAbility.disconnectAbility(connId).then((void) => {
| ------------------------------------ | ---------- | ------------------------------------------------------------ |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | 指示对URI执行读取操作的授权 |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | 指示对URI执行写入操作的授权 |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 将结果返回给能力 |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 将结果返回给能力 |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | 确定是否可以将本地设备上的功能迁移到远程设备 |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | 指定组件是否属于OHOS |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | 指定是否启动某个能力 |
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | 指示URI上可能持久化的授权 |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 将结果返回到源能力 |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 按照前缀匹配的方式验证URI权限 |
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | 支持分布式调度系统中的多设备启动 |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | 指示无论主机应用程序是否已启动,都将启动使用服务模板的功能 |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 表示迁移是可拉回的。 |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册