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

add code type for md codes

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