提交 1d381a40 编写于 作者: W wangdongqi

Signed-off-by: wangdongqi <wangdongqi2@huawei.com>

 Changes to be committed:
上级 f46cd827
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## 导入模块 ## 导入模块
```js ```js
import screenlock from '@ohos.screenLock'; import screenLock from '@ohos.screenLock';
``` ```
## EventType<sup>9+</sup> ## EventType<sup>9+</sup>
...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock'; ...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock';
| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 |
| params | string | 是 | 系统事件参数。 | | params | string | 是 | 系统事件参数。 |
## screenlock.isLocked<sup>9+</sup> ## screenLock.isLocked<sup>9+</sup>
isLocked(): boolean isLocked(): boolean
...@@ -69,10 +69,10 @@ isLocked(): boolean ...@@ -69,10 +69,10 @@ isLocked(): boolean
**示例:** **示例:**
```js ```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 unlock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlock((err, data) => { screenLock.unlock((err, data) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; 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; unlock(): Promise&lt;boolean&gt;
...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt; ...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.unlock().then((data) => { screenLock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`); console.info(`Succeeded in unlocking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); 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 lock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -168,17 +168,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -168,17 +168,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.lock((err, data) => { screenLock.lock((err, data) => {
if (err) { if (err) {
console.error(`Failed to lock the screen, because: ${err.message}`); console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`);
return; 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; lock(): Promise&lt;boolean&gt;
...@@ -204,15 +204,15 @@ lock(): Promise&lt;boolean&gt; ...@@ -204,15 +204,15 @@ lock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.lock().then((data) => { screenLock.lock().then((data) => {
console.info(`lock the screen successfully. result: ${data}`); console.info(`Succeeded in locking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to lock the screen, because: ${err.message}`); 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 onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
...@@ -244,17 +244,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean ...@@ -244,17 +244,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
**示例:** **示例:**
```js ```js
try { try {
let isSuccess = screenlock.onSystemEvent((event) => { let isSuccess = screenLock.onSystemEvent((event) => {
console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) console.log(`Succeeded in Registering the system event which related to screenlock. eventType: ${event.eventType}`)
}); });
} catch (err) { } catch (err) {
console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) console.error(`Failed to register the system event which 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 sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void
...@@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt ...@@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
if (err) { if (err) {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${result}`);
}); });
``` ```
## screenlock.sendScreenLockEvent<sup>9+</sup> ## screenLock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt; sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
...@@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt; ...@@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${result}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send 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 isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked((err, data)=>{ screenLock.isScreenLocked((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`);
return; 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; isScreenLocked(): Promise&lt;boolean&gt;
...@@ -383,15 +383,15 @@ isScreenLocked(): Promise&lt;boolean&gt; ...@@ -383,15 +383,15 @@ isScreenLocked(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info(`Obtain whether the screen is locked successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); 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 isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -411,17 +411,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -411,17 +411,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isSecureMode((err, data)=>{ screenLock.isSecureMode((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
return; 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; isSecureMode(): Promise&lt;boolean&gt;
...@@ -441,14 +441,15 @@ isSecureMode(): Promise&lt;boolean&gt; ...@@ -441,14 +441,15 @@ isSecureMode(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isSecureMode().then((data) => { screenLock.isSecureMode().then((data) => {
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}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup>
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(callback: AsyncCallback&lt;void&gt;): void unlockScreen(callback: AsyncCallback&lt;void&gt;): void
...@@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void ...@@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlockScreen((err) => { screenLock.unlockScreen((err) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info('unlock the screen successfully.'); console.info(`Succeeded unlocking the screen.`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup> ## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise&lt;void&gt; unlockScreen(): Promise&lt;void&gt;
...@@ -498,10 +499,10 @@ unlockScreen(): Promise&lt;void&gt; ...@@ -498,10 +499,10 @@ unlockScreen(): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
screenlock.unlockScreen().then(() => { screenLock.unlockScreen().then(() => {
console.info('unlock the screen successfully.'); console.info('Succeeded unlocking the screen.');
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); 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.
先完成此消息的编辑!
想要评论请 注册