未验证 提交 495999b0 编写于 作者: O openharmony_ci 提交者: Gitee

!4073 【OpenHarmony开源贡献者计划2022】API相关格式及表达问题-1

Merge pull request !4073 from king_he/api-a
# Distributed Account Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> 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.
......@@ -40,7 +40,7 @@ Provides methods for querying and updating the login state of a distributed acco
queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): void
Obtains distributed account information. This method uses an asynchronous callback to return the result.
Obtains distributed account information. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
......@@ -63,7 +63,7 @@ Obtains distributed account information. This method uses an asynchronous callba
queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
Obtains distributed account information. This method uses a promise to return the result asynchronously.
Obtains distributed account information. This API uses a promise to return the result asynchronously.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
......@@ -87,7 +87,7 @@ Obtains distributed account information. This method uses a promise to return th
updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback&lt;void&gt;): void
Updates distributed account information. This method uses an asynchronous callback to return the result.
Updates distributed account information. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications)
......@@ -110,7 +110,7 @@ Updates distributed account information. This method uses an asynchronous callba
updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt;
Updates distributed account information. This method uses a promise to return the result asynchronously.
Updates distributed account information. This API uses a promise to return the result asynchronously.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications)
......@@ -141,9 +141,9 @@ Updates distributed account information. This method uses a promise to return th
Defines distributed OS account information.
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of a distributed account. It must be a non-null string.|
| id | string | Yes| UID of a distributed account. It must be a non-null string.|
| event | string | Yes| Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| name | string | Yes| Name of a distributed account. It must be a non-null string. |
| id | string | Yes | UID of a distributed account. It must be a non-null string. |
| event | string | Yes | Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| scalableData | object | No| Extended information about a distributed account. Customized information is passed in key-value pairs.<br>Note: This parameter is reserved and not used in query and update methods.|
\ No newline at end of file
# File Interaction
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
- 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 will be deprecated and are not recommended for use. An exception will be thrown if any of the APIs is called.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> - 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 will be deprecated and are not recommended for use. An exception will be thrown if any of the APIs is called.
## Modules to Import
```js
......@@ -13,21 +13,21 @@ import document from '@ohos.document';
choose(type:string[]): Promise&lt;string&gt;
Chooses a file of the specified type using the file manager. This method uses a promise to return the result.
Chooses a file of the specified type using the file manager. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------- |
| type | string[] | No | Type of the file to choose.|
| type | string[] | No | Type of the file to choose. |
- Return value
| Type | Description |
| --------------------- | -------------- |
| Promise&lt;string&gt; | Promise used to return the result. An error code is returned.|
| Promise&lt;string&gt; | Promise used to return the result. An error code is returned. |
- Example
......@@ -38,15 +38,15 @@ Chooses a file of the specified type using the file manager. This method uses a
choose(callback:AsyncCallback&lt;string&gt;): void
Chooses a file using the file manager. This method uses an asynchronous callback to return the result.
Chooses a file using the file manager. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned. |
- Example
......@@ -59,16 +59,16 @@ Chooses a file using the file manager. This method uses an asynchronous callback
choose(type:string[], callback:AsyncCallback&lt;string&gt;): void
Chooses a file of the specified type using the file manager. This method uses an asynchronous callback to return the result.
Chooses a file of the specified type using the file manager. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| type | string[] | No | Type of the file to choose.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned.|
| type | string[] | No | Type of the file to choose. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned. |
- Example
......@@ -82,22 +82,22 @@ Chooses a file of the specified type using the file manager. This method uses an
show(url:string, type:string):Promise&lt;number&gt;
Opens a file. This method uses a promise to return the result.
Opens a file. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name| Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ---------------------------- |
| uri | string | Yes | URI of the file to open.|
| type | string | Yes | Type of the file to open.|
| uri | string | Yes | URI of the file to open. |
| type | string | Yes | Type of the file to open. |
- Return value
| Type | Description |
| --------------------- | ------------ |
| Promise&lt;void&gt; | Promise used to return the result. An error code is returned.|
| Promise&lt;void&gt; | Promise used to return the result. An error code is returned. |
- Example
......@@ -109,16 +109,16 @@ Opens a file. This method uses a promise to return the result.
show(url:string, type:string, callback:AsyncCallback&lt;void&gt;): void
Opens a file. This method uses an asynchronous callback to return the result.
Opens a file. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| uri | string | Yes | URI of the file to open.|
| type | string | Yes | Type of the file to open.|
| uri | string | Yes | URI of the file to open. |
| type | string | Yes | Type of the file to open. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. An error code is returned. |
- Example
......
# Emitter
> Note: The initial APIs of this module are supported since API version 7.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> The initial APIs of this module are supported since API version 7.
## Modules to Import
......@@ -20,7 +21,7 @@ Enumerates the event emit priority levels.
| --------- | ---- | ------------------------------------------------- |
| IMMEDIATE | 0 | The event will be emitted immediately.<br>**System capability**: SystemCapability.Notification.Emitter |
| HIGH | 1 | The event will be emitted before low-priority events.<br>**System capability**: SystemCapability.Notification.Emitter |
| LOW | 2 | The event will be emitted before idle-priority events. By default, an event is in LOW priority.<br>**System capability**: SystemCapability.Notification.Emitter|
| LOW | 2 | The event will be emitted before idle-priority events. By default, an event is in LOW priority.<br>**System capability**: SystemCapability.Notification.Emitter |
| IDLE | 3 | The event will be emitted after all the other events.<br>**System capability**: SystemCapability.Notification.Emitter |
## emitter.on
......@@ -33,10 +34,10 @@ Subscribes to an event in persistent manner. This API uses a callback to return
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ------------------------ |
| event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in persistent manner. |
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event.|
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event. |
**Example**
......@@ -60,10 +61,10 @@ Subscribes to an event in one-shot manner and unsubscribes from it after the eve
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ------------------------ |
| event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in one-shot manner. |
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event.|
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event. |
**Example**
......@@ -87,9 +88,9 @@ Unsubscribes from an event.
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ------ |
| eventId | number | Yes | Event ID.|
| eventId | number | Yes | Event ID. |
**Example**
......@@ -110,7 +111,7 @@ Emits an event to the event queue.
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | -------------- |
| event | [InnerEvent](#innerevent) | Yes | Event to emit. |
| data | [EventData](#eventdata) | No | Data carried by the event.|
| data | [EventData](#eventdata) | No | Data carried by the event. |
**Example**
......@@ -133,7 +134,7 @@ Describes an intra-process event.
| Name | Type | Readable| Writable| Description |
| -------- | ------------------------------- | ---- | ---- | ---------------------------------- |
| eventId | number | Yes | Yes | Event ID, which is used to identify an event.<br>**System capability**: SystemCapability.Notification.Emitter|
| eventId | number | Yes | Yes | Event ID, which is used to identify an event.<br>**System capability**: SystemCapability.Notification.Emitter |
| priority | [EventPriority](#eventpriority) | Yes | Yes | Emit priority of the event.<br>**System capability**: SystemCapability.Notification.Emitter |
## EventData
......@@ -142,4 +143,4 @@ Describes the data passed in the event.
| Name| Type | Readable| Writable| Description |
| ---- | ------------------ | ---- | ---- | -------------- |
| data | [key: string]: any | Yes | Yes | Data carried by the event. The data type can be String, Integer, or Boolean.<br>**System capability**: SystemCapability.Notification.Emitter|
| data | [key: string]: any | Yes | Yes | Data carried by the event. The data type can be String, Integer, or Boolean.<br>**System capability**: SystemCapability.Notification.Emitter |
# EventHub
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> 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.
......@@ -34,10 +34,10 @@ Subscribes to an event.
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description |
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| callback | Function | Yes| Callback invoked when the event is triggered.|
| event | string | Yes| Event name. |
| callback | Function | Yes| Callback invoked when the event is triggered. |
**Example**
......@@ -74,8 +74,8 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes
| 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.|
| event | string | Yes| Event name. |
| callback | Function | No | Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed. |
**Example**
......@@ -112,8 +112,8 @@ Triggers an event.
| 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.|
| event | string | Yes| Event name. |
| ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered. |
**Example**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册