提交 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 ...@@ -12,7 +12,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste
import power from '@ohos.power'; import power from '@ohos.power';
``` ```
## System Capabilities ## System Capability
SystemCapability.PowerManager.PowerManager.Core SystemCapability.PowerManager.PowerManager.Core
...@@ -25,7 +25,7 @@ Shuts down the system. ...@@ -25,7 +25,7 @@ Shuts down the system.
This is a system API and cannot be called by third-party applications. This is a system API and cannot be called by third-party applications.
**Required permission:** ohos.permission.SHUTDOWN **Required permission**: ohos.permission.REBOOT
**Parameters** **Parameters**
...@@ -45,9 +45,9 @@ console.info('power_shutdown_device_test success') ...@@ -45,9 +45,9 @@ console.info('power_shutdown_device_test success')
rebootDevice(reason: string): void 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** **Parameters**
...@@ -71,7 +71,7 @@ Checks the screen status of the current device. ...@@ -71,7 +71,7 @@ Checks the screen status of the current device.
**Parameters** **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.| | 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; ...@@ -94,10 +94,10 @@ isScreenOn(): Promise&lt;boolean&gt;
Checks the screen status of the current device. Checks the screen status of the current device.
**Return Value** **Return value**
| Type | Description | | 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** **Example**
......
...@@ -107,16 +107,16 @@ Creates a **RunningLock** object. ...@@ -107,16 +107,16 @@ Creates a **RunningLock** object.
**Example** **Example**
``` ```
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND, (error, lockIns) => {
.then(runninglock => { if (typeof error === "undefined") {
var used = runninglock.isUsed(); console.log('create runningLock test error: ' + error);
console.info('runninglock is used: ' + used); } else {
runninglock.lock(500); var used = lockIns.isUsed();
used = runninglock.isUsed(); console.info('runninglock is used: ' + used);
console.info('after lock runninglock is used ' + used); lockIns.lock(500);
}) used = lockIns.isUsed();
.catch(error => { console.info('after lock runninglock is used ' + used);
console.log('create runningLock test error: ' + error); }
}) })
``` ```
...@@ -170,11 +170,13 @@ Locks and holds a **RunningLock** object. ...@@ -170,11 +170,13 @@ Locks and holds a **RunningLock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Required permission:** ohos.permission.RUNNING_LOCK
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ------ | ---- | -------------------- | | ------- | ------ | ---- | -------------------------- |
| timeout | number | No | Duration for locking and holding the **RunningLock** object.| | timeout | number | No | Duration for locking and holding the **RunningLock** object, in ms.|
**Example** **Example**
...@@ -185,7 +187,7 @@ runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.B ...@@ -185,7 +187,7 @@ runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.B
console.info('create runningLock success') console.info('create runningLock success')
}) })
.catch(error => { .catch(error => {
console.log('Lock runningLock test error: ' + error) console.log('create runningLock test error: ' + error)
}); });
``` ```
...@@ -198,16 +200,18 @@ Releases a **Runninglock** object. ...@@ -198,16 +200,18 @@ Releases a **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Required permission:** ohos.permission.RUNNING_LOCK
**Example** **Example**
``` ```
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND)
.then(runningLock => { .then(runningLock => {
runningLock.unlock() runningLock.unlock()
console.info('unLock runningLock success') console.info('create and unLock runningLock success')
}) })
.catch(error => { .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.
先完成此消息的编辑!
想要评论请 注册