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

!20741 翻译完成 20471+19599+20078+20395+19795

Merge pull request !20741 from ester.zhou/TR-20471
......@@ -504,7 +504,7 @@ This API can be called only by an input method. Only one SOFT_KEYBOARD panel and
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
| 12800004 | not an input method extension. |
**Example**
......@@ -552,7 +552,7 @@ This API can be called only by an input method. Only one SOFT_KEYBOARD panel and
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
| 12800004 | not an input method extension. |
**Example**
......@@ -728,6 +728,57 @@ inputMethodEngine.getKeyboardDelegate().off('keyDown', (keyEvent) => {
});
```
### on('keyEvent')<sup>10+</sup>
on(type: 'keyEvent', callback: (event: InputKeyEvent) => boolean): void
Enables listening for a keyboard event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'keyEvent'** indicates the keyboard event.|
| callback | function | Yes | Callback used to return the result.<br>- The input parameter, of the [InputKeyEvent](js-apis-keyevent.md#KeyEvent) type, indicates the key event information.<br>- If the event is consumed by the event subscriber, **true** is returned. Otherwise, **false** is returned.|
**Example**
```js
inputMethodEngine.getKeyboardDelegate().on('keyEvent', (keyEvent) => {
console.log('inputMethodEngine keyEvent.action:' + JSON.stringify(keyEvent.action));
console.log('inputMethodEngine keyEvent.key.code:' + JSON.stringify(keyEvent.key.code));
console.log('inputMethodEngine keyEvent.ctrlKey:' + JSON.stringify(keyEvent.ctrlKey));
return true;
});
```
### off('keyEvent')<sup>10+</sup>
off(type: 'keyEvent', callback?: (event: InputKeyEvent) => boolean): void
Disables listening for a keyboard event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'keyEvent'** indicates the keyboard event.|
| callback | function | No | Callback to be unregistered.<br>- The input parameter, of the [InputKeyEvent](js-apis-keyevent.md#KeyEvent) type, indicates the key event information.<br>- If the event is consumed by the event subscriber, **true** is returned. Otherwise, **false** is returned.<br>- This parameter is optional. If this parameter is not specified, all callbacks registered for the event will be unregistered.|
**Example**
```js
inputMethodEngine.getKeyboardDelegate().off('keyEvent', (keyEvent) => {
console.log('This is a callback function which will be deregistered.');
return true;
});
inputMethodEngine.getKeyboardDelegate().off('keyEvent');
```
### on('cursorContextChange')
on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) => void): void
......@@ -1147,7 +1198,7 @@ This API does not work on panels in the FLG_FIXED state.
```js
try {
let promise = windowClass.moveTo(300, 300);
let promise = panel.moveTo(300, 300);
promise.then(() => {
console.log('Succeeded in moving the panel.');
}).catch((err) =>{
......@@ -1260,11 +1311,11 @@ promise.then(() => {
});
```
### on<sup>10+</sup>
### on('show')<sup>10+</sup>
on(type: 'show' | 'hide', callback: () => void): void
on(type: 'show', callback: () => void): void
Enables listening for a panel visibility event. This API uses an asynchronous callback to return the result.
Enables listening for the show event of this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -1272,7 +1323,7 @@ Enables listening for a panel visibility event. This API uses an asynchronous ca
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | 'show'\|'hide' | Yes| Listening type.<br>- The value **'show'** indicates the panel display event.<br>- The value **'hide'** indicates the panel hiding event.|
| type | string | Yes| Listening type.<br>The value **'show'** indicates the show event.|
| callback | () => void | Yes | Callback used to return the result.|
**Example**
......@@ -1283,11 +1334,11 @@ panel.on('show', () => {
});
```
### off<sup>10+</sup>
### on('hide')<sup>10+</sup>
off(type: 'show' | 'hide', callback?: () => void): void
on(type: 'hide', callback: () => void): void
Disables listening for a panel visibility event. This API uses an asynchronous callback to return the result.
Enables listening for the hide event of this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -1295,7 +1346,30 @@ Disables listening for a panel visibility event. This API uses an asynchronous c
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | 'show'\|'hide' | Yes| Listening type.<br>- The value **'show'** indicates the panel display event.<br>- The value **'hide'** indicates the panel hiding event.|
| type | string | Yes| Listening type.<br>The value **'hide'** indicates the hide event.|
| callback | () => void | Yes | Callback used to return the result.|
**Example**
```js
panel.on('hide', () => {
console.log('Panel is hiding.');
});
```
### off('show')<sup>10+</sup>
off(type: 'show', callback?: () => void): void
Disables listening for the show event of this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | string | Yes| Listening type.<br>The value **'show'** indicates the show event.|
| callback | () => void | No | Callback used to return the result.|
**Example**
......@@ -1304,6 +1378,27 @@ Disables listening for a panel visibility event. This API uses an asynchronous c
panel.off('show');
```
### off('hide')<sup>10+</sup>
off(type: 'hide', callback?: () => void): void
Disables listening for the hide event of this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | string | Yes| Listening type.<br>The value **'hide'** indicates the hide event.|
| callback | () => void | No | Callback used to return the result.|
**Example**
```js
panel.off('hide');
```
### changeFlag<sup>10+</sup>
changeFlag(flag: PanelFlag): void
......@@ -2487,7 +2582,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
| Error Code ID| Error Message |
| -------- | ------------------------------ |
| 12800003 | Input method client error. |
| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**Example**
......@@ -2523,7 +2618,7 @@ Describes the attribute of a key.
| Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------ |
| keyCode | number | Yes | No | Key value. For detail, see [KeyCode](js-apis-keycode.md#keycode).|
| keyCode | number | Yes | No | Key value. For details, see [KeyCode](js-apis-keycode.md#keycode).|
| keyAction | number | Yes | No | Key event type.<br>- **2**: keydown event.<br>- **3**: keyup event.|
## PanelFlag<sup>10+</sup>
......
......@@ -3515,7 +3515,7 @@ struct WebComponent {
pageUp(top:boolean): void
Scrolls the page up by half the view port or jumps to the top of the page.
Scrolls the page up by half the viewport or jumps to the top of the page.
**System capability**: SystemCapability.Web.Webview.Core
......@@ -3523,7 +3523,7 @@ Scrolls the page up by half the view port or jumps to the top of the page.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| top | boolean | Yes | Whether to jump to the top of the page. The value **true** means to jump to the top of the page; and **false** means to scroll the page up by half the view port.|
| top | boolean | Yes | Whether to jump to the top of the page. The value **true** means to jump to the top of the page; and **false** means to scroll the page up by half the viewport.|
**Error codes**
......@@ -3564,7 +3564,7 @@ struct WebComponent {
pageDown(bottom:boolean): void
Scrolls the page down by half the view port or jumps to the bottom of the page.
Scrolls the page down by half the viewport or jumps to the bottom of the page.
**System capability**: SystemCapability.Web.Webview.Core
......@@ -3572,7 +3572,7 @@ Scrolls the page down by half the view port or jumps to the bottom of the page.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| bottom | boolean | Yes | Whether to jump to the bottom of the page. The value **true** means to jump to the bottom of the page; and **false** means to scroll the page down by half the view port.|
| bottom | boolean | Yes | Whether to jump to the bottom of the page. The value **true** means to jump to the bottom of the page; and **false** means to scroll the page down by half the viewport.|
**Error codes**
......
......@@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | View port of the shape.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.|
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | Viewport of the shape.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
......
......@@ -34,7 +34,7 @@ This error code is reported when a file path error occurs in invoking the **uplo
**Possible Causes**
The file path is incorrect or the file aready exists in the path.
The file path is incorrect or the file already exists in the path.
**Solution**
......@@ -44,7 +44,7 @@ Verify the file path.
**Error Message**
Task manager service error.
Task service ability error.
**Description**
......@@ -57,3 +57,96 @@ The task fails to be created.
**Solution**
Verify the task settings.
## 21900004 Application Task Queue Full
**Error Message**
application task queue full error.
**Description**
This error code is reported when the application task queue is full.
**Possible Causes**
The application fails to create a background task (resources are preempted by foreground tasks, where no task queue is involved).
**Solution**
1. Obtain all background tasks of the application through the query API.
2. Proactively remove tasks not needed to release the quota.
3. Create a background task again.
## 21900005 Task Mode Error
**Error Message**
task mode error.
**Description**
This error code is reported when a task mode error occurs.
**Possible Causes**
The application attempts to create a foreground task when it is not running in the foreground.
**Solution**
1. Register and deregister an event listener for a foreground application.
2. Follow the instructions in the API reference document.
## 21900006 Task Not Found
**Error Message**
task not found error.
**Description**
This error code is reported when the task is not found.
**Possible Causes**
The task to remove or query does not exist.
**Solution**
1. Query existing tasks through the query API.
2. Check whether the target task exists. (The system periodically deletes junk tasks.)
3. Verify the task ID and try again.
## 21900007 Operation Not Supported in Current State
**Error Message**
task mode error.
**Description**
This error code is reported when the operation performed is not supported.
**Possible Causes**
1. The task to start has been deleted.
2. The task to start has not been initialized.
3. The task to pause is not being executed.
4. The task to resume is not paused.
5. The task to stop is not being executed.
**Solution**
1. Check the task status.
2. Perform the operation supported by the current task status.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册