diff --git a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md index d627fed783604e6d04c6568c79038137e1ebb465..897ae78e35702c06a9bd647cf57b51e0774a6a9a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md +++ b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md @@ -8,7 +8,7 @@ ## 导入模块 -``` +```js import batteryInfo from '@ohos.batteryInfo'; ``` @@ -32,7 +32,7 @@ SystemCapability.PowerManager.BatteryManager.Core | isBatteryPresent7+ | boolean | 是 | 否 | 表示当前设备是否支持电池或者电池是否在位。 | - 示例: - ``` + ```js import batteryInfo from '@ohos.batteryInfo'; var batterySoc = batteryInfo.batterySOC; ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-brightness.md index bf0de9a4bbfa53cef3559bc455c1a4c417e3ebe5..17676f2c3a129536fcce34ca4e5cb418676d736a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-brightness.md @@ -8,7 +8,7 @@ ## 导入模块 -``` +```js import brightness from '@ohos.brightness'; ``` @@ -30,6 +30,6 @@ setValue(value: number): void **示例:** -``` +```js brightness.setValue(128); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-power.md b/zh-cn/application-dev/reference/apis/js-apis-power.md index d1223b75c2bd846a0200af2b2531feba746e2b85..33c658da30403564e62b2a2c111fe03256477114 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-power.md +++ b/zh-cn/application-dev/reference/apis/js-apis-power.md @@ -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<boolean>): void **示例:** -``` +```js power.isScreenOn((error, screenOn) => { if (typeof error === "undefined") { console.info('screenOn status is ' + screenOn); @@ -101,7 +101,7 @@ isScreenOn(): Promise<boolean> **示例:** -``` +```js power.isScreenOn() .then(screenOn => { console.info('screenOn status is ' + screenOn); diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md index ccb5244b06308dcc0b51ce1c73c0c99a79ccf6d6..09b8a7a4c4e1e30ce097702132ea8f02e94227fa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @@ -7,7 +7,7 @@ ## 导入模块 -``` +```js import screenlock from '@ohos.screenLock'; ``` @@ -27,7 +27,7 @@ isScreenLocked(callback: AsyncCallback<boolean>): void - 示例: - ``` + ```js screenlock.isScreenLocked((err, data)=>{ if (err) { console.error('isScreenLocked callback error -> ${JSON.stringify(err)}'); @@ -53,7 +53,7 @@ isScreenLocked(): Promise<boolean> - 示例: - ``` + ```js screenlock.isScreenLocked().then((data) => { console.log('isScreenLocked success: data -> ${JSON.stringify(data)}'); }).catch((err) => { @@ -80,7 +80,7 @@ isSecureMode(callback: AsyncCallback<boolean>): void - 示例: - ``` + ```js screenlock.isSecureMode((err, data)=>{ if (err) { console.error('isSecureMode callback error -> ${JSON.stringify(err)}'); @@ -106,7 +106,7 @@ isSecureMode(): Promise<boolean> - 示例: - ``` + ```js screenlock.isSecureMode().then((data) => { console.log('isSecureMode success: data->${JSON.stringify(data)}'); }).catch((err) => { @@ -133,7 +133,7 @@ unlockScreen(callback: AsyncCallback<void>): void - 示例: - ``` + ```js screenlock.unlockScreen((err)=>{ if (err) { console.error('unlockScreen callback error -> ${JSON.stringify(err)}'); @@ -159,7 +159,7 @@ unlockScreen(): Promise<void> - 示例: - ``` + ```js screenlock.unlockScreen().then(() => { console.log('unlockScreen success'); }).catch((err) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md index 2f9e575a01de78fc69b6371162bb602c0a68db39..3a52e071218063300184d674c36bafbced129641 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md @@ -9,7 +9,7 @@ ## 导入模块 -``` +```js import battery from '@system.battery'; ``` @@ -39,7 +39,7 @@ success返回值: **示例:** -``` +```js export default { getStatus() { battery.getStatus({ diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md index b8e3a07ba1cfbd0ba2e65854bb2db8acb32c0ff1..aa52115fe4f88eea6c57b03ede1731d73c11cefd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @@ -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({ diff --git a/zh-cn/application-dev/reference/apis/js-apis-thermal.md b/zh-cn/application-dev/reference/apis/js-apis-thermal.md index a351b62f9031399d8851fa2c93e081fcd7e08869..b79cd24da0151f0a065005b7b2660fad7eb27603 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-thermal.md +++ b/zh-cn/application-dev/reference/apis/js-apis-thermal.md @@ -8,7 +8,7 @@ ## 导入模块 -``` +```js import thermal from '@ohos.thermal'; ``` @@ -46,7 +46,7 @@ subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void **示例:** -``` +```js var lev = 0; thermal.subscribeThermalLevel((lev) => { console.info("Thermal level is: " + lev); @@ -69,7 +69,7 @@ unsubscribeThermalLevel(callback?: AsyncCallback\): 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); ```