From 8e3c34dbabb85ada5f2b9f1ae060c534ef988150 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Tue, 29 Mar 2022 17:47:12 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- .../reference/apis/js-apis-power.md | 14 ++++---- .../reference/apis/js-apis-runninglock.md | 36 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-power.md b/en/application-dev/reference/apis/js-apis-power.md index d3e6377b84..ca7e76cf6d 100644 --- a/en/application-dev/reference/apis/js-apis-power.md +++ b/en/application-dev/reference/apis/js-apis-power.md @@ -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<boolean> | Yes | Callback used to obtain the return value.
Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.| @@ -94,10 +94,10 @@ isScreenOn(): Promise<boolean> Checks the screen status of the current device. -**Return Value** +**Return value** | Type | Description | | ---------------------- | --------------------------------------- | -| Promise<boolean> | Promise used to asynchronously obtain the return value.
Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.| +| Promise<boolean> | Promise used to obtain the return value.
Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md index b2d01bd6da..4a9ba2ab23 100644 --- a/en/application-dev/reference/apis/js-apis-runninglock.md +++ b/en/application-dev/reference/apis/js-apis-runninglock.md @@ -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) }); ``` -- GitLab