提交 8e3c34db 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 953e6510
......@@ -12,7 +12,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste
import power from '@ohos.power';
```
## System Capabilities
## System Capability
SystemCapability.PowerManager.PowerManager.Core
......@@ -25,7 +25,7 @@ Shuts down the system.
This is a system API and cannot be called by third-party applications.
**Required permission:** ohos.permission.SHUTDOWN
**Required permission**: ohos.permission.REBOOT
**Parameters**
......@@ -45,9 +45,9 @@ console.info('power_shutdown_device_test success')
rebootDevice(reason: string): void
Restarts the device.
Reboots the system.
**Required permission:** ohos.permission.REBOOT (to reboot) or ohos.permission.REBOOT_UPDATER (to reboot and enter the updater mode)
**Required permission**: ohos.permission.REBOOT (to reboot) or ohos.permission.REBOOT_RECOVERY (to reboot and enter the recovery or updater mode)
**Parameters**
......@@ -71,7 +71,7 @@ Checks the screen status of the current device.
**Parameters**
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to obtain the return value.<br>Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.|
......@@ -94,10 +94,10 @@ isScreenOn(): Promise&lt;boolean&gt;
Checks the screen status of the current device.
**Return Value**
**Return value**
| Type | Description |
| ---------------------- | --------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to asynchronously obtain the return value. <br/>Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.|
| Promise&lt;boolean&gt; | Promise used to obtain the return value. <br/>Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.|
**Example**
......
......@@ -107,16 +107,16 @@ Creates a **RunningLock** object.
**Example**
```
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => {
var used = runninglock.isUsed();
console.info('runninglock is used: ' + used);
runninglock.lock(500);
used = runninglock.isUsed();
console.info('after lock runninglock is used ' + used);
})
.catch(error => {
console.log('create runningLock test error: ' + error);
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND, (error, lockIns) => {
if (typeof error === "undefined") {
console.log('create runningLock test error: ' + error);
} else {
var used = lockIns.isUsed();
console.info('runninglock is used: ' + used);
lockIns.lock(500);
used = lockIns.isUsed();
console.info('after lock runninglock is used ' + used);
}
})
```
......@@ -170,11 +170,13 @@ Locks and holds a **RunningLock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
**Required permission:** ohos.permission.RUNNING_LOCK
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | -------------------- |
| timeout | number | No | Duration for locking and holding the **RunningLock** object.|
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | -------------------------- |
| timeout | number | No | Duration for locking and holding the **RunningLock** object, in ms.|
**Example**
......@@ -185,7 +187,7 @@ runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.B
console.info('create runningLock success')
})
.catch(error => {
console.log('Lock runningLock test error: ' + error)
console.log('create runningLock test error: ' + error)
});
```
......@@ -198,16 +200,18 @@ Releases a **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
**Required permission:** ohos.permission.RUNNING_LOCK
**Example**
```
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND)
.then(runningLock => {
runningLock.unlock()
console.info('unLock runningLock success')
console.info('create and unLock runningLock success')
})
.catch(error => {
console.log('unLock runningLock test error: ' + error)
console.log('create runningLock test error: ' + error)
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册