Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
124163cd
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
124163cd
编写于
9月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!24096 [Fix]: 电源服务文档的ArkTS适配
Merge pull request !24096 from 龙晓峰/master
上级
78c5d174
7e7c1dd8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
64 addition
and
64 deletion
+64
-64
zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md
...plication-dev/reference/apis/js-apis-batteryStatistics.md
+7
-7
zh-cn/application-dev/reference/apis/js-apis-power.md
zh-cn/application-dev/reference/apis/js-apis-power.md
+7
-7
zh-cn/application-dev/reference/apis/js-apis-runninglock.md
zh-cn/application-dev/reference/apis/js-apis-runninglock.md
+24
-24
zh-cn/application-dev/reference/apis/js-apis-system-battery.md
.../application-dev/reference/apis/js-apis-system-battery.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-system-brightness.md
...plication-dev/reference/apis/js-apis-system-brightness.md
+20
-20
zh-cn/application-dev/reference/apis/js-apis-thermal.md
zh-cn/application-dev/reference/apis/js-apis-thermal.md
+4
-4
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md
浏览文件 @
124163cd
...
...
@@ -42,10 +42,10 @@ getBatteryStats(): Promise<Array<BatteryStatsInfo>>
```
js
batteryStats
.
getBatteryStats
()
.
then
(
data
=>
{
.
then
(
(
data
:
batteryStats
.
BatteryStatsInfo
[])
=>
{
console
.
info
(
'
battery statistics info:
'
+
data
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
get battery statistics failed, err:
'
+
err
);
});
```
...
...
@@ -77,7 +77,7 @@ getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void
**示例:**
```
js
batteryStats
.
getBatteryStats
((
err
,
data
)
=>
{
batteryStats
.
getBatteryStats
((
err
:
BusinessError
<
void
>
,
data
:
batteryStats
.
BatteryStatsInfo
[]
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
battery statistics info:
'
+
data
);
}
else
{
...
...
@@ -120,7 +120,7 @@ getAppPowerValue(uid: number): number
```
js
try
{
var
value
=
batteryStats
.
getAppPowerValue
(
10021
);
let
value
=
batteryStats
.
getAppPowerValue
(
10021
);
console
.
info
(
'
battery statistics value of app is:
'
+
value
);
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics value of app failed, err:
'
+
err
);
...
...
@@ -161,7 +161,7 @@ getAppPowerPercent(uid: number): number
```
js
try
{
var
percent
=
batteryStats
.
getAppPowerPercent
(
10021
);
let
percent
=
batteryStats
.
getAppPowerPercent
(
10021
);
console
.
info
(
'
battery statistics percent of app is:
'
+
percent
);
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of app failed, err:
'
+
err
);
...
...
@@ -202,7 +202,7 @@ getHardwareUnitPowerValue(type: ConsumptionType): number
```
js
try
{
var
value
=
batteryStats
.
getHardwareUnitPowerValue
(
batteryStats
.
ConsumptionType
.
CONSUMPTION_TYPE_SCREEN
);
let
value
=
batteryStats
.
getHardwareUnitPowerValue
(
batteryStats
.
ConsumptionType
.
CONSUMPTION_TYPE_SCREEN
);
console
.
info
(
'
battery statistics value of hardware is:
'
+
value
);
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
...
...
@@ -243,7 +243,7 @@ getHardwareUnitPowerPercent(type: ConsumptionType): number
```
js
try
{
var
percent
=
batteryStats
.
getHardwareUnitPowerPercent
(
batteryStats
.
ConsumptionType
.
CONSUMPTION_TYPE_SCREEN
);
let
percent
=
batteryStats
.
getHardwareUnitPowerPercent
(
batteryStats
.
ConsumptionType
.
CONSUMPTION_TYPE_SCREEN
);
console
.
info
(
'
battery statistics percent of hardware is:
'
+
percent
);
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
...
...
zh-cn/application-dev/reference/apis/js-apis-power.md
浏览文件 @
124163cd
...
...
@@ -104,7 +104,7 @@ isActive(): boolean
```
js
try
{
var
isActive
=
power
.
isActive
();
let
isActive
=
power
.
isActive
();
console
.
info
(
'
power is active:
'
+
isActive
);
}
catch
(
err
)
{
console
.
error
(
'
check active status failed, err:
'
+
err
);
...
...
@@ -206,7 +206,7 @@ getPowerMode(): DevicePowerMode
```
js
try
{
var
mode
=
power
.
getPowerMode
();
let
mode
=
power
.
getPowerMode
();
console
.
info
(
'
power mode:
'
+
mode
);
}
catch
(
err
)
{
console
.
error
(
'
get power mode failed, err:
'
+
err
);
...
...
@@ -243,7 +243,7 @@ setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void
**示例:**
```
js
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
err
=>
{
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
(
err
:
BusinessError
<
void
>
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
set power mode to MODE_PERFORMANCE
'
);
}
else
{
...
...
@@ -322,7 +322,7 @@ isStandby(): boolean
```
js
try
{
var
isStandby
=
power
.
isStandby
();
let
isStandby
=
power
.
isStandby
();
console
.
info
(
'
device is in standby:
'
+
isStandby
);
}
catch
(
err
)
{
console
.
error
(
'
check isStandby failed, err:
'
+
err
);
...
...
@@ -372,7 +372,7 @@ isScreenOn(callback: AsyncCallback<boolean>): void
**示例:**
```
js
power
.
isScreenOn
((
err
,
data
)
=>
{
power
.
isScreenOn
((
err
:
BusinessError
<
void
>
,
data
:
boolean
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
screen on status is
'
+
data
);
}
else
{
...
...
@@ -400,10 +400,10 @@ isScreenOn(): Promise<boolean>
```
js
power
.
isScreenOn
()
.
then
(
data
=>
{
.
then
(
(
data
:
boolean
)
=>
{
console
.
info
(
'
screen on status is
'
+
data
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
check screen status failed, err:
'
+
err
);
})
```
...
...
zh-cn/application-dev/reference/apis/js-apis-runninglock.md
浏览文件 @
124163cd
...
...
@@ -44,7 +44,7 @@ isSupported(type: RunningLockType): boolean;
```
js
try
{
var
isSupported
=
runningLock
.
isSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
);
let
isSupported
=
runningLock
.
isSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
);
console
.
info
(
'
BACKGROUND type supported:
'
+
isSupported
);
}
catch
(
err
)
{
console
.
error
(
'
check supported failed, err:
'
+
err
);
...
...
@@ -72,7 +72,7 @@ create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLo
**示例:**
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
,
l
ock
)
=>
{
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
:
BusinessError
<
void
>
,
lock
:
runningLock
.
RunningL
ock
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
created running lock:
'
+
lock
);
}
else
{
...
...
@@ -108,10 +108,10 @@ create(name: string, type: RunningLockType): Promise<RunningLock>
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
created running lock:
'
+
lock
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, error:
'
+
err
);
});
```
...
...
@@ -136,7 +136,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boo
**示例:**
```
js
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
,
data
)
=>
{
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
:
BusinessError
<
void
>
,
data
:
boolean
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
BACKGROUND lock support status:
'
+
data
);
}
else
{
...
...
@@ -171,10 +171,10 @@ isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>
```
js
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
data
=>
{
.
then
(
(
data
:
boolean
)
=>
{
console
.
info
(
'
BACKGROUND lock support status:
'
+
data
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
log
(
'
check BACKGROUND lock support status failed, err:
'
+
err
);
});
```
...
...
@@ -202,7 +202,7 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l
**示例:**
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
,
l
ock
)
=>
{
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
:
BusinessError
<
void
>
,
lock
:
runningLock
.
RunningL
ock
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
created running lock:
'
+
lock
);
}
else
{
...
...
@@ -240,10 +240,10 @@ createRunningLock(name: string, type: RunningLockType): Promise<RunningLock&g
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
created running lock:
'
+
lock
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
log
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -280,7 +280,7 @@ hold(timeout: number): void
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
try
{
lock
.
hold
(
500
);
...
...
@@ -289,7 +289,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
console
.
error
(
'
hold running lock failed, err:
'
+
err
);
}
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -316,7 +316,7 @@ unhold(): void
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
try
{
lock
.
unhold
();
...
...
@@ -325,7 +325,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
console
.
error
(
'
unhold running lock failed, err:
'
+
err
);
}
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -356,16 +356,16 @@ isHolding(): boolean
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
try
{
var
isHolding
=
lock
.
isHolding
();
let
isHolding
=
lock
.
isHolding
();
console
.
info
(
'
check running lock holding status:
'
+
isHolding
);
}
catch
(
err
)
{
console
.
error
(
'
check running lock holding status failed, err:
'
+
err
);
}
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -392,11 +392,11 @@ lock(timeout: number): void
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
lock
.
lock
(
500
);
console
.
info
(
'
create running lock and lock success
'
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -417,11 +417,11 @@ unlock(): void
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
lock
.
unlock
();
console
.
info
(
'
create running lock and unlock success
'
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
```
...
...
@@ -445,11 +445,11 @@ isUsed(): boolean
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
var
isUsed
=
lock
.
isUsed
();
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
let
isUsed
=
lock
.
isUsed
();
console
.
info
(
'
check running lock used status:
'
+
isUsed
);
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
check running lock used status failed, err:
'
+
err
);
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-system-battery.md
浏览文件 @
124163cd
...
...
@@ -33,10 +33,10 @@ getStatus(options?: GetStatusOptions): void;
```
js
battery
.
getStatus
({
success
:
function
(
data
)
{
success
:
(
data
:
BatteryResponse
)
=>
{
console
.
log
(
'
success get battery level:
'
+
data
.
level
);
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
fail to get battery level code:
'
+
code
+
'
, data:
'
+
data
);
}
});
...
...
zh-cn/application-dev/reference/apis/js-apis-system-brightness.md
浏览文件 @
124163cd
...
...
@@ -34,11 +34,11 @@ getValue(options?: GetBrightnessOptions): void
```
js
brightness
.
getValue
({
success
:
function
(
data
)
{
console
.
log
(
'
success get brightness value:
'
+
data
.
value
);
success
:
(
data
:
BrightnessResponse
)
=>
{
console
.
log
(
'
success get brightness value:
'
+
data
.
value
);
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
get brightness fail, code:
'
+
code
+
'
, data:
'
+
data
);
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
get brightness fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
```
...
...
@@ -63,11 +63,11 @@ setValue(options?: SetBrightnessOptions): void
```
js
brightness
.
setValue
({
value
:
100
,
success
:
function
()
{
console
.
log
(
'
handling set brightness success.
'
);
success
:
()
=>
{
console
.
log
(
'
handling set brightness success.
'
);
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling set brightness value fail, code:
'
+
code
+
'
, data:
'
+
data
);
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set brightness value fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
```
...
...
@@ -91,11 +91,11 @@ getMode(options?: GetBrightnessModeOptions): void
```
js
brightness
.
getMode
({
success
:
function
(
data
)
{
console
.
log
(
'
success get mode:
'
+
data
.
mode
);
success
:
(
data
:
BrightnessModeResponse
)
=>
{
console
.
log
(
'
success get mode:
'
+
data
.
mode
);
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling get mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling get mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
```
...
...
@@ -119,11 +119,11 @@ setMode(options?: SetBrightnessModeOptions): void
```
js
brightness
.
setMode
({
mode
:
1
,
success
:
function
()
{
console
.
log
(
'
handling set mode success.
'
);
success
:
()
=>
{
console
.
log
(
'
handling set mode success.
'
);
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling set mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
```
...
...
@@ -150,11 +150,11 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void
```
js
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
success
:
function
()
{
console
.
log
(
'
handling set keep screen on success.
'
);
success
:
()
=>
{
console
.
log
(
'
handling set keep screen on success.
'
);
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-thermal.md
浏览文件 @
124163cd
...
...
@@ -38,7 +38,7 @@ registerThermalLevelCallback(callback: Callback<ThermalLevel>): void
```
js
try
{
thermal
.
registerThermalLevelCallback
(
level
=>
{
thermal
.
registerThermalLevelCallback
(
(
level
:
thermal
.
ThermalLevel
)
=>
{
console
.
info
(
'
thermal level is:
'
+
level
);
});
console
.
info
(
'
register thermal level callback success.
'
);
...
...
@@ -108,7 +108,7 @@ getLevel(): ThermalLevel
```
js
try
{
var
level
=
thermal
.
getLevel
();
let
level
=
thermal
.
getLevel
();
console
.
info
(
'
thermal level is:
'
+
level
);
}
catch
(
err
)
{
console
.
error
(
'
get thermal level failed, err:
'
+
err
);
...
...
@@ -134,7 +134,7 @@ subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void
**示例:**
```
js
thermal
.
subscribeThermalLevel
((
l
evel
)
=>
{
thermal
.
subscribeThermalLevel
((
err
:
BusinessError
<
void
>
,
level
:
thermal
.
ThermalL
evel
)
=>
{
console
.
info
(
'
thermal level is:
'
+
level
);
});
```
...
...
@@ -182,7 +182,7 @@ getThermalLevel(): ThermalLevel
**示例:**
```
js
var
level
=
thermal
.
getThermalLevel
();
let
level
=
thermal
.
getThermalLevel
();
console
.
info
(
'
thermal level is:
'
+
level
);
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录