提交 617366a5 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 bb8a35c1
# Battery Info<a name="EN-US_TOPIC_0000001121409574"></a>
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>![](../../public_sys-resources/icon-note.gif) **NOTE**
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Battery Info module provides APIs for querying the charger type, battery health status, and battery charging status.
......@@ -8,7 +8,7 @@ The Battery Info module provides APIs for querying the charger type, battery hea
## Modules to Import<a name="section199443271307"></a>
```
```js
import batteryInfo from '@ohos.batteryInfo';
```
......@@ -126,7 +126,7 @@ Describes battery information.
- Example
```
```js
import batteryInfo from '@ohos.batteryInfo';
var batterySoc = batteryInfo.batterySOC;
```
......
......@@ -8,7 +8,7 @@ The Brightness module provides an API for setting the screen brightness.
## Modules to Import
```
```js
import brightness from '@ohos.brightness';
```
......@@ -30,6 +30,6 @@ This is a system API and cannot be called by third-party applications.
**Example**
```
```js
brightness.setValue(128);
```
......@@ -6,7 +6,7 @@
## Modules to Import
```
```js
import hichecker from '@ohos.hichecker';
```
......@@ -42,7 +42,7 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac
**Example**
```
```js
// Add a rule.
hichecker.addRule(hichecker.RULE_CAUTION_PRINT_LOG);
......@@ -67,7 +67,7 @@ Removes one or more rules. The removed rules will become ineffective.
**Example**
```
```js
// Remove a rule.
hichecker.removeRule(hichecker.RULE_CAUTION_PRINT_LOG);
......@@ -92,7 +92,7 @@ Obtains a collection of thread, process, and alarm rules that have been added.
**Example**
```
```js
// Add a rule.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
......@@ -122,7 +122,7 @@ Checks whether the specified rule exists in the collection of added rules. If th
**Example**
```
```js
// Add a rule.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
......
......@@ -8,7 +8,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste
## Modules to Import
```
```js
import power from '@ohos.power';
```
......@@ -35,7 +35,7 @@ This is a system API and cannot be called by third-party applications.
**Example**
```
```js
power.shutdownDevice("shutdown_test");
console.info('power_shutdown_device_test success')
```
......@@ -57,7 +57,7 @@ Reboots the system.
**Example**
```
```js
power.rebootDevice("reboot_test");
console.info('power_reboot_device_test success')
```
......@@ -77,7 +77,7 @@ Checks the screen status of the current device.
**Example**
```
```js
power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") {
console.info('screenOn status is ' + screenOn);
......@@ -101,7 +101,7 @@ Checks the screen status of the current device.
**Example**
```
```js
power.isScreenOn()
.then(screenOn => {
console.info('screenOn status is ' + screenOn);
......
# Screen Lock Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
```js
import screenlock from '@ohos.screenLock';
```
......@@ -28,7 +28,7 @@ Checks whether the screen is locked. This method uses an asynchronous callback t
- Example
```
```js
screenlock.isScreenLocked((err, data)=>{
if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
......@@ -54,7 +54,7 @@ Checks whether the screen is locked. This method uses a promise to return the re
- Example
```
```js
screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => {
......@@ -81,7 +81,7 @@ Checks whether a device is in secure mode. This method uses an asynchronous call
- Example
```
```js
screenlock.isSecureMode((err, data)=>{
if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
......@@ -107,7 +107,7 @@ Checks whether a device is in secure mode. This method uses a promise to return
- Example
```
```js
screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => {
......@@ -134,7 +134,7 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu
- Example
```
```js
screenlock.unlockScreen((err)=>{
if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
......@@ -160,7 +160,7 @@ Unlocks the screen. This method uses a promise to return the result.
- Example
```
```js
screenlock.unlockScreen().then(() => {
console.log('unlockScreen success');
}).catch((err) => {
......
# Battery Level
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.batteryInfo`](js-apis-battery-info.md) instead.
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -9,7 +9,7 @@
## Modules to Import
```
```js
import battery from '@system.battery';
```
......@@ -39,7 +39,7 @@ The following value will be returned when the check result is obtained.
**Example**
```
```js
export default {
getStatus() {
battery.getStatus({
......
# Screen Brightness
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.brightness`](js-apis-brightness.md) instead.
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -9,7 +9,7 @@
## Modules to Import
```
```js
import brightness from '@system.brightness';
```
......@@ -38,7 +38,7 @@ The following values will be returned when the operation is successful.
**Example**
```
```js
export default {
getValue() {
brightness.getValue({
......@@ -73,7 +73,7 @@ Sets the screen brightness.
**Example**
```
```js
export default {
setValue() {
brightness.setValue({
......@@ -114,7 +114,7 @@ The following values will be returned when the operation is successful.
**Example**
```
```js
export default {
getMode() {
brightness.getMode({
......@@ -149,7 +149,7 @@ Sets the screen brightness adjustment mode.
**Example**
```
```js
export default {
setMode() {
brightness.setMode({
......@@ -185,7 +185,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**.
**Example**
```
```js
export default {
setKeepScreenOn() {
brightness.setKeepScreenOn({
......
......@@ -8,7 +8,7 @@ This module provides thermal level-related callback and query APIs to obtain the
## Modules to Import
```
```js
import thermal from '@ohos.thermal';
```
......@@ -46,7 +46,7 @@ Subscribes to thermal level changes.
**Example**
```
```js
var lev = 0;
thermal.subscribeThermalLevel((lev) => {
console.info("Thermal level is: " + lev);
......@@ -69,7 +69,7 @@ Unsubscribes from thermal level changes.
**Example**
```
```js
thermal.unsubscribeThermalLevel(() => {
console.info("Unsubscribe completed.");
});
......@@ -91,7 +91,7 @@ Obtains the current thermal level.
**Example**
```
```js
var lev = thermal.getThermalLevel();
console.info("Thermal level is: " + lev);
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册