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

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

 Changes to be committed:
上级 f46cd827
......@@ -9,7 +9,7 @@
## 导入模块
```js
import screenlock from '@ohos.screenLock';
import screenLock from '@ohos.screenLock';
```
## EventType<sup>9+</sup>
......@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock';
| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 |
| params | string | 是 | 系统事件参数。 |
## screenlock.isLocked<sup>9+</sup>
## screenLock.isLocked<sup>9+</sup>
isLocked(): boolean
......@@ -69,10 +69,10 @@ isLocked(): boolean
**示例:**
```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 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```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 @@ unlock(): Promise&lt;boolean&gt;
**示例:**
```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 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```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 @@ lock(): Promise&lt;boolean&gt;
**示例:**
```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 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
**示例:**
```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 which 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 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
......@@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt
**示例:**
```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 screenlock event, Code: ${err.code}, message: ${err.message}`);
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;
......@@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
**示例:**
```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 screenlock event. result: ${result}`);
}).catch((err) => {
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
......@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```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 @@ isScreenLocked(): Promise&lt;boolean&gt;
**示例:**
```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 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```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 @@ isSecureMode(): Promise&lt;boolean&gt;
**示例:**
```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 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```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 unlocking the screen.`);
});
```
## screenlock.unlockScreen<sup>(deprecated)</sup>
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise&lt;void&gt;
......@@ -498,10 +499,10 @@ unlockScreen(): Promise&lt;void&gt;
**示例:**
```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 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.
先完成此消息的编辑!
想要评论请 注册