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

!21939 【3.2-Release】翻译完成 21577+20676+20793+20575

Merge pull request !21939 from ester.zhou/C2-21577
......@@ -25,9 +25,9 @@ Implements initialization for the interpolation curve, which is used to create a
**Parameters**
| Name| Type | Mandatory| Default Value | Description |
| ------ | ------------------------------------------------------------ | ---- | ------------ | ---------- |
| curve | [Curve](../arkui-ts/ts-appendix-enums.md#curve) | No | Curve.Linear | Curve type.|
| Name| Type | Mandatory| Description |
| ------ | --------------- | ---- | ----------------------------------- |
| curve | [Curve](#curve) | No | Curve type.<br>Default value: **Curve.Linear**|
**Return value**
......@@ -35,6 +35,28 @@ Implements initialization for the interpolation curve, which is used to create a
| ---------------------------------- | ---------------- |
| [ICurve](#icurve) | Interpolation curve.|
## Curve
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Description |
| ------------------- | ------------------------------------------------------------ |
| Linear | The animation speed keeps unchanged. |
| Ease | The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used.|
| EaseIn | The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used. |
| EaseOut | The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used. |
| EaseInOut | The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used.|
| FastOutSlowIn | The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0). |
| LinearOutSlowIn | The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0). |
| FastOutLinearIn | The animation uses the acceleration cubic-bezier curve (0.4, 0.0, 1.0, 1.0). |
| ExtremeDeceleration | The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0). |
| Sharp | The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0). |
| Rhythm | The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0). |
| Smooth | The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0). |
| Friction | The animation uses the friction cubic-bezier curve (0.2, 0.0, 0.2, 1.0). |
**Example**
```ts
......@@ -151,16 +173,16 @@ Creates a spring animation curve. If multiple spring animations are applied to t
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- |
| response | number | No | Duration of one complete oscillation,<br>Default value: **0.55**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.55**.|
| response | number | No | Duration of one complete oscillation.<br>Default value: **0.55**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.55**.|
| dampingFraction | number | No | Damping coefficient.<br>**0**: undamped. In this case, the spring oscillates forever.<br>> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.<br>**1**: critically damped.<br>> 1: overdamped. In this case, the spring approaches equilibrium gradually.<br>Default value: **0.825**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.55**.|
| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.<br><br>Default value: **0**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0**.<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, the **response** values of these animations will transit smoothly over this duration if they are different.<br>Default value: **0**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0**.<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). The time cannot be normalized. Therefore, the interpolation cannot be obtained using the **interpolate** function of the curve.|
**Return value**
| Type | Description |
| ---------------------------------- | ---------------- |
| [ICurve](#icurve)| Curve.<br>**NOTE**<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
| [ICurve](#icurve)| Curve.<br>**NOTE**<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). The time cannot be normalized. Therefore, the interpolation cannot be obtained using the [interpolate](#interpolate9) function of the curve.|
**Example**
......@@ -187,13 +209,13 @@ Creates a responsive spring animation curve. It is a special case of [springMoti
| --------- | ------ | ---- | ----- |
| response | number | No | See **response** in **springMotion**.<br>Default value: **0.15**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.15**.|
| dampingFraction | number | No | See **dampingFraction** in **springMotion**.<br>Default value: **0.86**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.86**.|
| overlapDuration | number | No | See **overlapDuration** in **springMotion**.<br>Default value: **0.25**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.25**.<br> To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. In addition, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
| overlapDuration | number | No | See **overlapDuration** in **springMotion**.<br>Default value: **0.25**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.25**.<br> To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). In addition, the interpolation cannot be obtained using the **interpolate** function of the curve.|
**Return value**
| Type | Description |
| ---------------------------------- | ---------------- |
| [ICurve](#icurve)| Curve.<br>**NOTE**<br>1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the **interpolate** function of the curve.|
| [ICurve](#icurve)| Curve.<br>**NOTE**<br>1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained using the [interpolate](#interpolate9) function of the curve.|
**Example**
......@@ -206,7 +228,7 @@ Curves.responsiveSpringMotion() // Create a responsive spring animation curve wi
## ICurve
### interpolate
### interpolate<sup>9+</sup>
interpolate(fraction: number): number
......@@ -248,9 +270,9 @@ Implements initialization to create a curve. This API is deprecated since API ve
**Parameters**
| Name| Type | Mandatory| Default Value | Description |
| ------ | ------------------------------------------------------------ | ---- | ------------ | ---------- |
| curve |[Curve](../arkui-ts/ts-appendix-enums.md#curve) | No | Curve.Linear | Curve type.|
| Name| Type | Mandatory| Description |
| ------ | --------------- | ---- | ----------------------------------- |
| curve | [Curve](#curve) | No | Curve type.<br>Default value: **Curve.Linear**|
## Curves.steps<sup>(deprecated)</sup>
......
......@@ -27,7 +27,7 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| option | [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**.<br>Default value:<br>[1,&nbsp;0,&nbsp;0,&nbsp;0,<br>0,&nbsp;1,&nbsp;0,&nbsp;0,<br>0,&nbsp;0,&nbsp;1,&nbsp;0,<br>0,&nbsp;0,&nbsp;0,&nbsp;1] |
| option | [number,number,number,number,<br>number,number,number,number,<br>number,number,number,number,<br>number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**.<br>Default value:<br>[1, 0, 0, 0,<br>0, 1, 0, 0,<br>0, 0, 1, 0,<br>0, 0, 0, 1] |
**Return value**
......@@ -145,7 +145,6 @@ Copies this matrix object.
```ts
// xxx.ets
import matrix4 from '@ohos.matrix4'
@Entry
@Component
struct Test {
......@@ -170,6 +169,132 @@ struct Test {
![en-us_image_0000001219744181](figures/en-us_image_0000001219744181.png)
## matrix4.invert<sup>(deprecated)</sup>
invert(): Matrix4Transit
Inverts this matrix object.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------------- |
| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
## matrix4.combine<sup>(deprecated)</sup>
combine(options: Matrix4Transit): Matrix4Transit
Combines the effects of two matrices to generate a new matrix object.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | --------------------------------- | ---- | ------------------ |
| option | [Matrix4Transit](#matrix4transit) | Yes | Matrix object to be combined.|
**Return value**
| Type | Description |
| --------------------------------- | ---------------------- |
| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
## matrix4.translate<sup>(deprecated)</sup>
translate(options: TranslateOption): Matrix4Transit
Translates this matrix object along the x, y, and z axes.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------------- | ---- | -------------- |
| option | [TranslateOption](#translateoption) | Yes | Translation configuration.|
**Return value**
| Type | Description |
| --------------------------------- | ---------------------- |
| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
## matrix4.scale<sup>(deprecated)</sup>
scale(options: ScaleOption): Matrix4Transit
Scales this matrix object along the x, y, and z axes.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | --------------------------- | ---- | -------------- |
| option | [ScaleOption](#scaleoption) | Yes | Scaling configuration.|
**Return value**
| Type | Description |
| --------------------------------- | ---------------------- |
| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
## matrix4.rotate<sup>(deprecated)</sup>
rotate(options: RotateOption): Matrix4Transit
Rotates this matrix object along the x, y, and z axes.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | -------------- |
| option | [RotateOption](#rotateoption) | Yes | Rotation configuration.|
**Return value**
| Type | Description |
| --------------------------------- | ---------------------- |
| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
## matrix4.transformPoint<sup>(deprecated)</sup>
transformPoint(options: [number, number]): [number, number]
Applies the current transformation effect to a coordinate point.
This API is deprecated since API version 10.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------- | ---- | ------------------ |
| option | [number, number] | Yes | Point to be transformed.|
**Return value**
| Type | Description |
| ---------------- | --------------------------- |
| [number, number] | Point object after matrix transformation|
## Matrix4Transit
......@@ -200,7 +325,6 @@ Combines the effects of two matrices to generate a new matrix object.
```ts
// xxx.ets
import matrix4 from '@ohos.matrix4'
@Entry
@Component
struct Test {
......@@ -249,7 +373,6 @@ import matrix4 from '@ohos.matrix4'
// The effect of matrix 1 (width scaled up by 2x) is opposite to that of matrix 2 (width scaled down by 2x).
let matrix1 = matrix4.identity().scale({ x: 2 })
let matrix2 = matrix1.invert()
@Entry
@Component
struct Tests {
......@@ -296,7 +419,6 @@ Translates this matrix object along the x, y, and z axes.
```ts
// xxx.ets
import matrix4 from '@ohos.matrix4'
@Entry
@Component
struct Test {
......@@ -387,7 +509,6 @@ Rotates this matrix object along the x, y, and z axes.
```ts
// xxx.ets
import matrix4 from '@ohos.matrix4'
@Entry
@Component
struct Test {
......
......@@ -50,7 +50,7 @@ Creates a **PasteData** object of a custom type.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mimeType | string | Yes| MIME type of custom data.|
| mimeType | string | Yes| MIME type of custom data. The value can a predefined MIME type listed in [Constants](#constants), including HTML, WANT, plain text, URI, and pixel map, or a custom MIME type.|
| value | [ValueType](#valuetype9) | Yes| Content of custom data.|
**Return value**
......@@ -59,12 +59,20 @@ Creates a **PasteData** object of a custom type.
| -------- | -------- |
| [PasteData](#pastedata) | **PasteData** object.|
**Example**
**Example 1**
```js
let dataXml = new ArrayBuffer(256);
```js
let dataXml = new ArrayBuffer(256);
let pasteData = pasteboard.createData('app/xml', dataXml);
```
```
**Example 2**
```js
let dataText = 'hello';
let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, dataText);
```
## pasteboard.createRecord<sup>9+</sup>
......@@ -78,7 +86,7 @@ Creates a **PasteDataRecord** object of the custom type.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mimeType | string | Yes| MIME type of custom data.|
| mimeType | string | Yes| MIME type of custom data. The value can a predefined MIME type listed in [Constants](#constants), including HTML, WANT, plain text, URI, and pixel map, or a custom MIME type. |
| value | [ValueType](#valuetype9) | Yes| Content of custom data.|
**Return value**
......@@ -87,12 +95,19 @@ Creates a **PasteDataRecord** object of the custom type.
| -------- | -------- |
| [PasteDataRecord](#pastedatarecord7) | New **PasteDataRecord** object of the custom type.|
**Example**
**Example 1**
```js
```js
let dataXml = new ArrayBuffer(256);
let pasteDataRecord = pasteboard.createRecord('app/xml', dataXml);
```
```
**Example 2**
```js
let dataUri = 'dataability:///com.example.myapplication1/user.txt';
let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, dataUri);
```
## pasteboard.getSystemPasteboard
......@@ -1286,7 +1301,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er
**Example**
```js
let pasteData = pasteboard.createPlainTextData('content');
let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content');
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteData, (err, data) => {
if (err) {
......@@ -1329,7 +1344,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er
**Example**
```js
let pasteData = pasteboard.createPlainTextData('content');
let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content');
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteData).then((data) => {
console.info('Succeeded in setting PasteData.');
......
......@@ -9,7 +9,7 @@ The **screenlock** module is a system module in OpenHarmony. It provides APIs fo
## Modules to Import
```js
import screenlock from '@ohos.screenLock';
import screenLock from '@ohos.screenLock';
```
## EventType<sup>9+</sup>
......@@ -50,7 +50,7 @@ Defines the structure of the system event callback.
| eventType | [EventType](#eventtype9) | Yes | System event type.|
| params | string | Yes | System event parameters.|
## screenlock.isLocked<sup>9+</sup>
## screenLock.isLocked<sup>9+</sup>
isLocked(): boolean
......@@ -69,10 +69,10 @@ Checks whether the screen is locked.
**Example**
```js
let isLocked = screenlock.isLocked();
let isLocked = screenLock.isLocked();
```
## screenlock.unlock<sup>9+</sup>
## screenLock.unlock<sup>9+</sup>
unlock(callback: AsyncCallback&lt;boolean&gt;): void
......@@ -98,17 +98,17 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.unlock((err, data) => {
```js
screenLock.unlock((err, data) => {
if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`);
return;
console.error(`Failed to unlock the screen. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`unlock the screen successfully. result: ${data}`);
});
```
console.info(`Succeeded in unlocking the screen. Result: ${data}`);
});
```
## screenlock.unlock<sup>9+</sup>
## screenLock.unlock<sup>9+</sup>
unlock(): Promise&lt;boolean&gt;
......@@ -134,15 +134,15 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`);
});
```
```js
screenLock.unlock().then((data) => {
console.info(`Succeeded in unlocking the screen. Result: ${data}`);
}).catch((err) => {
console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
});
```
## screenlock.lock<sup>9+</sup>
## screenLock.lock<sup>9+</sup>
lock(callback: AsyncCallback&lt;boolean&gt;): void
......@@ -168,17 +168,17 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.lock((err, data) => {
```js
screenLock.lock((err, data) => {
if (err) {
console.error(`Failed to lock the screen, because: ${err.message}`);
return;
console.error(`Failed to lock the screen. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`lock the screen successfully. result: ${data}`);
});
```
console.info(`Succeeded in locking the screen. result: ${data}`);
});
```
## screenlock.lock<sup>9+</sup>
## screenLock.lock<sup>9+</sup>
lock(): Promise&lt;boolean&gt;
......@@ -204,15 +204,15 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.lock().then((data) => {
console.info(`lock the screen successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to lock the screen, because: ${err.message}`);
});
```
```js
screenLock.lock().then((data) => {
console.info(`Succeeded in locking the screen. Result: ${data}`);
}).catch((err) => {
console.error(`Failed to lock the screen. Code: ${err.code}, message: ${err.message}`);
});
```
## screenlock.onSystemEvent<sup>9+</sup>
## screenLock.onSystemEvent<sup>9+</sup>
onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
......@@ -244,17 +244,17 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
try {
let isSuccess = screenlock.onSystemEvent((event) => {
console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`)
```js
try {
let isSuccess = screenLock.onSystemEvent((event) => {
console.log(`Succeeded in registering the system event related to screenlock. eventType: ${event.eventType}`)
});
} catch (err) {
console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`)
}
```
} catch (err) {
console.error(`Failed to register the system event related to screenlock. Code: ${err.code}, message: ${err.message}`)
}
```
## screenlock.sendScreenLockEvent<sup>9+</sup>
## screenLock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void
......@@ -282,17 +282,17 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
```js
screenLock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
if (err) {
console.error(`Failed to send screenlock event, because: ${err.message}`);
return;
console.error(`Failed to send the screenlock event. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Send screenlock event successfully. result: ${result}`);
});
```
console.info(`Succeeded in sending the screenlock event. result: ${result}`);
});
```
## screenlock.sendScreenLockEvent<sup>9+</sup>
## screenLock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
......@@ -325,15 +325,15 @@ For details about the error codes, see [Screen Lock Management Error Codes](../e
**Example**
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.info(`Send screenlock event successfully. result: ${result}`);
}).catch((err) => {
console.error(`Failed to send screenlock event, because: ${err.message}`);
});
```
```js
screenLock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.info(`Succeeded in sending the screenlock event. Result: ${result}`);
}).catch((err) => {
console.error(`Failed to send the screenlock event. Code: ${err.code}, message: ${err.message}`);
});
```
## screenlock.isScreenLocked<sup>(deprecated)</sup>
## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
......@@ -353,17 +353,17 @@ Checks whether the screen is locked. This API uses an asynchronous callback to r
**Example**
```js
screenlock.isScreenLocked((err, data)=>{
```js
screenLock.isScreenLocked((err, data)=>{
if (err) {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`);
return;
console.error(`Failed to obtain whether the screen is locked. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Obtain whether the screen is locked successfully. result: ${data}`);
});
```
console.info(`Succeeded in obtaining whether the screen is locked. Result: ${data}`);
});
```
## screenlock.isScreenLocked<sup>(deprecated)</sup>
## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(): Promise&lt;boolean&gt;
......@@ -383,15 +383,15 @@ Checks whether the screen is locked. This API uses a promise to return the resul
**Example**
```js
screenlock.isScreenLocked().then((data) => {
console.info(`Obtain whether the screen is locked successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`);
});
```
```js
screenLock.isScreenLocked().then((data) => {
console.info(`Succeeded in obtaining whether the screen is locked. Result: ${data}`);
}).catch((err) => {
console.error(`Failed to obtain whether the screen is locked. Code: ${err.code}, message: ${err.message}`);
});
```
## screenlock.isSecureMode<sup>(deprecated)</sup>
## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
......@@ -411,17 +411,17 @@ Checks whether the device is in secure mode. When the device is in secure mode,
**Example**
```js
screenlock.isSecureMode((err, data)=>{
```js
screenLock.isSecureMode((err, data)=>{
if (err) {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`);
return;
console.error(`Failed to obtain whether the device is in secure mode. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`);
});
```
console.info(`Succeeded in obtaining whether the device is in secure mode. Result: ${data}`);
});
```
## screenlock.isSecureMode<sup>(deprecated)</sup>
## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(): Promise&lt;boolean&gt;
......@@ -441,14 +441,15 @@ Checks whether the device is in secure mode. When the device is in secure mode,
**Example**
```js
screenlock.isSecureMode().then((data) => {
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`);
});
```
## screenlock.unlockScreen<sup>(deprecated)</sup>
```js
screenLock.isSecureMode().then((data) => {
console.info(`Succeeded in obtaining whether the device is in secure mode. Result: ${data}`);
}).catch((err) => {
console.error(`Failed to obtain whether the device is in secure mode. Code: ${err.code}, message: ${err.message}`);
});
```
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(callback: AsyncCallback&lt;void&gt;): void
......@@ -468,17 +469,17 @@ Unlocks the screen. This API uses an asynchronous callback to return the result.
**Example**
```js
screenlock.unlockScreen((err) => {
```js
screenLock.unlockScreen((err) => {
if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`);
return;
console.error(`Failed to unlock the screen. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('unlock the screen successfully.');
});
```
console.info(`Succeeded in unlocking the screen.`);
});
```
## screenlock.unlockScreen<sup>(deprecated)</sup>
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise&lt;void&gt;
......@@ -498,10 +499,10 @@ Unlocks the screen. This API uses a promise to return the result.
**Example**
```js
screenlock.unlockScreen().then(() => {
console.info('unlock the screen successfully.');
}).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`);
});
```
```js
screenLock.unlockScreen().then(() => {
console.info('Succeeded in unlocking the screen.');
}).catch((err) => {
console.error(`Failed to unlock the screen. Code: ${err.code}, message: ${err.message}`);
});
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册