提交 8acd07f1 编写于 作者: A aqxyjay

add code type for md codes

Signed-off-by: Naqxyjay <zhangchunxin@huawei.com>
上级 1375c6b9
......@@ -8,7 +8,7 @@
## 导入模块
```
```js
import batteryInfo from '@ohos.batteryInfo';
```
......@@ -32,7 +32,7 @@ SystemCapability.PowerManager.BatteryManager.Core
| isBatteryPresent<sup>7+</sup> | boolean | 是 | 否 | 表示当前设备是否支持电池或者电池是否在位。 |
- 示例:
```
```js
import batteryInfo from '@ohos.batteryInfo';
var batterySoc = batteryInfo.batterySOC;
```
......
......@@ -8,7 +8,7 @@
## 导入模块
```
```js
import brightness from '@ohos.brightness';
```
......@@ -30,6 +30,6 @@ setValue(value: number): void
**示例:**
```
```js
brightness.setValue(128);
```
......@@ -8,7 +8,7 @@
## 导入模块
```
```js
import power from '@ohos.power';
```
......@@ -35,7 +35,7 @@ shutdownDevice(reason: string): void
**示例:**
```
```js
power.shutdownDevice("shutdown_test");
console.info('power_shutdown_device_test success')
```
......@@ -57,7 +57,7 @@ rebootDevice(reason: string): void
**示例:**
```
```js
power.rebootDevice("reboot_test");
console.info('power_reboot_device_test success')
```
......@@ -77,7 +77,7 @@ isScreenOn(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```
```js
power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") {
console.info('screenOn status is ' + screenOn);
......@@ -101,7 +101,7 @@ isScreenOn(): Promise&lt;boolean&gt;
**示例:**
```
```js
power.isScreenOn()
.then(screenOn => {
console.info('screenOn status is ' + screenOn);
......
......@@ -7,7 +7,7 @@
## 导入模块
```
```js
import screenlock from '@ohos.screenLock';
```
......@@ -27,7 +27,7 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
- 示例:
```
```js
screenlock.isScreenLocked((err, data)=>{
if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
......@@ -53,7 +53,7 @@ isScreenLocked(): Promise&lt;boolean&gt;
- 示例:
```
```js
screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => {
......@@ -80,7 +80,7 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
- 示例:
```
```js
screenlock.isSecureMode((err, data)=>{
if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
......@@ -106,7 +106,7 @@ isSecureMode(): Promise&lt;boolean&gt;
- 示例:
```
```js
screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => {
......@@ -133,7 +133,7 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void
- 示例:
```
```js
screenlock.unlockScreen((err)=>{
if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
......@@ -159,7 +159,7 @@ unlockScreen(): Promise&lt;void&gt;
- 示例:
```
```js
screenlock.unlockScreen().then(() => {
console.log('unlockScreen success');
}).catch((err) => {
......
......@@ -9,7 +9,7 @@
## 导入模块
```
```js
import battery from '@system.battery';
```
......@@ -39,7 +39,7 @@ success返回值:
**示例:**
```
```js
export default {
getStatus() {
battery.getStatus({
......
......@@ -9,7 +9,7 @@
## 导入模块
```
```js
import brightness from '@system.brightness';
```
......@@ -37,7 +37,7 @@ success返回值:
**示例:**
```
```js
export default {
getValue() {
brightness.getValue({
......@@ -71,7 +71,7 @@ setValue(Object): void
**示例:**
```
```js
export default {
setValue() {
brightness.setValue({
......@@ -111,7 +111,7 @@ getMode(Object): void
**示例:**
```
```js
export default {
getMode() {
brightness.getMode({
......@@ -145,7 +145,7 @@ setMode(Object): void
**示例:**
```
```js
export default {
setMode() {
brightness.setMode({
......@@ -180,7 +180,7 @@ setKeepScreenOn(Object): void
**示例:**
```
```js
export default {
setKeepScreenOn() {
brightness.setKeepScreenOn({
......
......@@ -8,7 +8,7 @@
## 导入模块
```
```js
import thermal from '@ohos.thermal';
```
......@@ -46,7 +46,7 @@ subscribeThermalLevel(callback: AsyncCallback&lt;ThermalLevel&gt;): void
**示例:**
```
```js
var lev = 0;
thermal.subscribeThermalLevel((lev) => {
console.info("Thermal level is: " + lev);
......@@ -69,7 +69,7 @@ unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void
**示例:**
```
```js
thermal.unsubscribeThermalLevel(() => {
console.info("Unsubscribe completed.");
});
......@@ -91,7 +91,7 @@ getThermalLevel(): ThermalLevel
**示例:**
```
```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.
先完成此消息的编辑!
想要评论请 注册