You need to sign in or sign up before continuing.
提交 88a6422b 编写于 作者: W wusongqing

update doc against 5814

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 76c75b09
...@@ -23,15 +23,17 @@ matchMediaSync(condition: string): MediaQueryListener ...@@ -23,15 +23,17 @@ matchMediaSync(condition: string): MediaQueryListener
Sets the media query criteria and returns the corresponding listening handle. Sets the media query criteria and returns the corresponding listening handle.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------- | | --------- | ------ | ---- | ---------------------------------------- |
| condition | string | Yes | Matching condition of a media event.| | condition | string | Yes | Matching condition of a media event. For details, see [Syntax of Media Query Conditions](../../ui/ui-ts-layout-mediaquery.md#syntax-of-media-query-conditions).|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------ | ---------------------- | | ------------------ | ---------------------- |
| MediaQueryListener | Listening handle to a media event, which is used to register or unregister the listening callback.| | MediaQueryListener | Listening handle to a media event, which is used to register or deregister the listening callback.|
**Example** **Example**
```js ```js
...@@ -43,6 +45,7 @@ listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for ...@@ -43,6 +45,7 @@ listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for
Media query handle, including the first query result when the handle is applied for. Media query handle, including the first query result when the handle is applied for.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### Attributes ### Attributes
...@@ -58,6 +61,8 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void ...@@ -58,6 +61,8 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void
Registers a callback with the corresponding query condition by using the handle. This callback is triggered when the media attributes change. Registers a callback with the corresponding query condition by using the handle. This callback is triggered when the media attributes change.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ---------------- | | -------- | -------------------------------- | ---- | ---------------- |
...@@ -72,12 +77,15 @@ Registers a callback with the corresponding query condition by using the handle. ...@@ -72,12 +77,15 @@ Registers a callback with the corresponding query condition by using the handle.
off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): void off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): void
Unregisters a callback with the corresponding query condition by using the handle, so that no callback is triggered when the media attributes change. Deregisters a callback with the corresponding query condition by using the handle, so that no callback is triggered when the media attributes change.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ----------------------------- | | -------- | -------------------------------- | ---- | ----------------------------- |
| type | boolean | Yes | Must enter the string **change**. | | type | boolean | Yes | Must enter the string **change**. |
| callback | Callback&lt;MediaQueryResult&gt; | No | Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.| | callback | Callback&lt;MediaQueryResult&gt; | No | Callback to be deregistered. If the default value is used, all callbacks of the handle are deregistered.|
**Example** **Example**
```js ```js
...@@ -92,7 +100,7 @@ Unregisters a callback with the corresponding query condition by using the handl ...@@ -92,7 +100,7 @@ Unregisters a callback with the corresponding query condition by using the handl
} }
} }
listener.on('change', onPortrait) // Register a callback. listener.on('change', onPortrait) // Register a callback.
listener.off('change', onPortrait) // Unregister a callback. listener.off('change', onPortrait) // Deregister a callback.
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册