Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7e7c1dd8
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看板
提交
7e7c1dd8
编写于
9月 06, 2023
作者:
L
longxiaofeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: Adaptation changes of adding internal public event
Signed-off-by:
N
longxiaofeng
<
longxiaofeng5@huawei.com
>
上级
d6467882
变更
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
浏览文件 @
7e7c1dd8
...
@@ -42,10 +42,10 @@ getBatteryStats(): Promise<Array<BatteryStatsInfo>>
...
@@ -42,10 +42,10 @@ getBatteryStats(): Promise<Array<BatteryStatsInfo>>
```
js
```
js
batteryStats
.
getBatteryStats
()
batteryStats
.
getBatteryStats
()
.
then
(
data
=>
{
.
then
(
(
data
:
batteryStats
.
BatteryStatsInfo
[])
=>
{
console
.
info
(
'
battery statistics info:
'
+
data
);
console
.
info
(
'
battery statistics info:
'
+
data
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
get battery statistics failed, err:
'
+
err
);
console
.
error
(
'
get battery statistics failed, err:
'
+
err
);
});
});
```
```
...
@@ -77,7 +77,7 @@ getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void
...
@@ -77,7 +77,7 @@ getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void
**示例:**
**示例:**
```
js
```
js
batteryStats
.
getBatteryStats
((
err
,
data
)
=>
{
batteryStats
.
getBatteryStats
((
err
:
BusinessError
<
void
>
,
data
:
batteryStats
.
BatteryStatsInfo
[]
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
battery statistics info:
'
+
data
);
console
.
info
(
'
battery statistics info:
'
+
data
);
}
else
{
}
else
{
...
@@ -120,7 +120,7 @@ getAppPowerValue(uid: number): number
...
@@ -120,7 +120,7 @@ getAppPowerValue(uid: number): number
```
js
```
js
try
{
try
{
var
value
=
batteryStats
.
getAppPowerValue
(
10021
);
let
value
=
batteryStats
.
getAppPowerValue
(
10021
);
console
.
info
(
'
battery statistics value of app is:
'
+
value
);
console
.
info
(
'
battery statistics value of app is:
'
+
value
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics value of app failed, err:
'
+
err
);
console
.
error
(
'
get battery statistics value of app failed, err:
'
+
err
);
...
@@ -161,7 +161,7 @@ getAppPowerPercent(uid: number): number
...
@@ -161,7 +161,7 @@ getAppPowerPercent(uid: number): number
```
js
```
js
try
{
try
{
var
percent
=
batteryStats
.
getAppPowerPercent
(
10021
);
let
percent
=
batteryStats
.
getAppPowerPercent
(
10021
);
console
.
info
(
'
battery statistics percent of app is:
'
+
percent
);
console
.
info
(
'
battery statistics percent of app is:
'
+
percent
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of app failed, err:
'
+
err
);
console
.
error
(
'
get battery statistics percent of app failed, err:
'
+
err
);
...
@@ -202,7 +202,7 @@ getHardwareUnitPowerValue(type: ConsumptionType): number
...
@@ -202,7 +202,7 @@ getHardwareUnitPowerValue(type: ConsumptionType): number
```
js
```
js
try
{
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
);
console
.
info
(
'
battery statistics value of hardware is:
'
+
value
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
...
@@ -243,7 +243,7 @@ getHardwareUnitPowerPercent(type: ConsumptionType): number
...
@@ -243,7 +243,7 @@ getHardwareUnitPowerPercent(type: ConsumptionType): number
```
js
```
js
try
{
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
);
console
.
info
(
'
battery statistics percent of hardware is:
'
+
percent
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
console
.
error
(
'
get battery statistics percent of hardware failed, err:
'
+
err
);
...
...
zh-cn/application-dev/reference/apis/js-apis-power.md
浏览文件 @
7e7c1dd8
...
@@ -104,7 +104,7 @@ isActive(): boolean
...
@@ -104,7 +104,7 @@ isActive(): boolean
```
js
```
js
try
{
try
{
var
isActive
=
power
.
isActive
();
let
isActive
=
power
.
isActive
();
console
.
info
(
'
power is active:
'
+
isActive
);
console
.
info
(
'
power is active:
'
+
isActive
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
check active status failed, err:
'
+
err
);
console
.
error
(
'
check active status failed, err:
'
+
err
);
...
@@ -206,7 +206,7 @@ getPowerMode(): DevicePowerMode
...
@@ -206,7 +206,7 @@ getPowerMode(): DevicePowerMode
```
js
```
js
try
{
try
{
var
mode
=
power
.
getPowerMode
();
let
mode
=
power
.
getPowerMode
();
console
.
info
(
'
power mode:
'
+
mode
);
console
.
info
(
'
power mode:
'
+
mode
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get power mode failed, err:
'
+
err
);
console
.
error
(
'
get power mode failed, err:
'
+
err
);
...
@@ -243,7 +243,7 @@ setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void
...
@@ -243,7 +243,7 @@ setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
err
=>
{
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
(
err
:
BusinessError
<
void
>
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
set power mode to MODE_PERFORMANCE
'
);
console
.
info
(
'
set power mode to MODE_PERFORMANCE
'
);
}
else
{
}
else
{
...
@@ -322,7 +322,7 @@ isStandby(): boolean
...
@@ -322,7 +322,7 @@ isStandby(): boolean
```
js
```
js
try
{
try
{
var
isStandby
=
power
.
isStandby
();
let
isStandby
=
power
.
isStandby
();
console
.
info
(
'
device is in standby:
'
+
isStandby
);
console
.
info
(
'
device is in standby:
'
+
isStandby
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
check isStandby failed, err:
'
+
err
);
console
.
error
(
'
check isStandby failed, err:
'
+
err
);
...
@@ -372,7 +372,7 @@ isScreenOn(callback: AsyncCallback<boolean>): void
...
@@ -372,7 +372,7 @@ isScreenOn(callback: AsyncCallback<boolean>): void
**示例:**
**示例:**
```
js
```
js
power
.
isScreenOn
((
err
,
data
)
=>
{
power
.
isScreenOn
((
err
:
BusinessError
<
void
>
,
data
:
boolean
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
screen on status is
'
+
data
);
console
.
info
(
'
screen on status is
'
+
data
);
}
else
{
}
else
{
...
@@ -400,10 +400,10 @@ isScreenOn(): Promise<boolean>
...
@@ -400,10 +400,10 @@ isScreenOn(): Promise<boolean>
```
js
```
js
power
.
isScreenOn
()
power
.
isScreenOn
()
.
then
(
data
=>
{
.
then
(
(
data
:
boolean
)
=>
{
console
.
info
(
'
screen on status is
'
+
data
);
console
.
info
(
'
screen on status is
'
+
data
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
check screen status failed, err:
'
+
err
);
console
.
error
(
'
check screen status failed, err:
'
+
err
);
})
})
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-runninglock.md
浏览文件 @
7e7c1dd8
...
@@ -44,7 +44,7 @@ isSupported(type: RunningLockType): boolean;
...
@@ -44,7 +44,7 @@ isSupported(type: RunningLockType): boolean;
```
js
```
js
try
{
try
{
var
isSupported
=
runningLock
.
isSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
);
let
isSupported
=
runningLock
.
isSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
);
console
.
info
(
'
BACKGROUND type supported:
'
+
isSupported
);
console
.
info
(
'
BACKGROUND type supported:
'
+
isSupported
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
check supported failed, err:
'
+
err
);
console
.
error
(
'
check supported failed, err:
'
+
err
);
...
@@ -72,7 +72,7 @@ create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLo
...
@@ -72,7 +72,7 @@ create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLo
**示例:**
**示例:**
```
js
```
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
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
created running lock:
'
+
lock
);
console
.
info
(
'
created running lock:
'
+
lock
);
}
else
{
}
else
{
...
@@ -108,10 +108,10 @@ create(name: string, type: RunningLockType): Promise<RunningLock>
...
@@ -108,10 +108,10 @@ create(name: string, type: RunningLockType): Promise<RunningLock>
```
js
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
created running lock:
'
+
lock
);
console
.
info
(
'
created running lock:
'
+
lock
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, error:
'
+
err
);
console
.
error
(
'
create running lock failed, error:
'
+
err
);
});
});
```
```
...
@@ -136,7 +136,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boo
...
@@ -136,7 +136,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boo
**示例:**
**示例:**
```
js
```
js
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
,
data
)
=>
{
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
,
(
err
:
BusinessError
<
void
>
,
data
:
boolean
)
=>
{
if
(
typeof
err
===
'
undefined
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
BACKGROUND lock support status:
'
+
data
);
console
.
info
(
'
BACKGROUND lock support status:
'
+
data
);
}
else
{
}
else
{
...
@@ -171,10 +171,10 @@ isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>
...
@@ -171,10 +171,10 @@ isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>
```
js
```
js
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
data
=>
{
.
then
(
(
data
:
boolean
)
=>
{
console
.
info
(
'
BACKGROUND lock support status:
'
+
data
);
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
);
console
.
log
(
'
check BACKGROUND lock support status failed, err:
'
+
err
);
});
});
```
```
...
@@ -202,7 +202,7 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l
...
@@ -202,7 +202,7 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l
**示例:**
**示例:**
```
js
```
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
'
)
{
if
(
typeof
err
===
'
undefined
'
)
{
console
.
info
(
'
created running lock:
'
+
lock
);
console
.
info
(
'
created running lock:
'
+
lock
);
}
else
{
}
else
{
...
@@ -240,10 +240,10 @@ createRunningLock(name: string, type: RunningLockType): Promise<RunningLock&g
...
@@ -240,10 +240,10 @@ createRunningLock(name: string, type: RunningLockType): Promise<RunningLock&g
```
js
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
created running lock:
'
+
lock
);
console
.
info
(
'
created running lock:
'
+
lock
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
log
(
'
create running lock failed, err:
'
+
err
);
console
.
log
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -280,7 +280,7 @@ hold(timeout: number): void
...
@@ -280,7 +280,7 @@ hold(timeout: number): void
```
js
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
console
.
info
(
'
create running lock success
'
);
try
{
try
{
lock
.
hold
(
500
);
lock
.
hold
(
500
);
...
@@ -289,7 +289,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
...
@@ -289,7 +289,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
console
.
error
(
'
hold running lock failed, err:
'
+
err
);
console
.
error
(
'
hold running lock failed, err:
'
+
err
);
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -316,7 +316,7 @@ unhold(): void
...
@@ -316,7 +316,7 @@ unhold(): void
```
js
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
console
.
info
(
'
create running lock success
'
);
try
{
try
{
lock
.
unhold
();
lock
.
unhold
();
...
@@ -325,7 +325,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
...
@@ -325,7 +325,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
console
.
error
(
'
unhold running lock failed, err:
'
+
err
);
console
.
error
(
'
unhold running lock failed, err:
'
+
err
);
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -356,16 +356,16 @@ isHolding(): boolean
...
@@ -356,16 +356,16 @@ isHolding(): boolean
```
js
```
js
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
create
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
console
.
info
(
'
create running lock success
'
);
console
.
info
(
'
create running lock success
'
);
try
{
try
{
var
isHolding
=
lock
.
isHolding
();
let
isHolding
=
lock
.
isHolding
();
console
.
info
(
'
check running lock holding status:
'
+
isHolding
);
console
.
info
(
'
check running lock holding status:
'
+
isHolding
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
check running lock holding status failed, err:
'
+
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
);
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -392,11 +392,11 @@ lock(timeout: number): void
...
@@ -392,11 +392,11 @@ lock(timeout: number): void
```
js
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
lock
.
lock
(
500
);
lock
.
lock
(
500
);
console
.
info
(
'
create running lock and lock success
'
);
console
.
info
(
'
create running lock and lock success
'
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -417,11 +417,11 @@ unlock(): void
...
@@ -417,11 +417,11 @@ unlock(): void
```
js
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
lock
.
unlock
();
lock
.
unlock
();
console
.
info
(
'
create running lock and unlock success
'
);
console
.
info
(
'
create running lock and unlock success
'
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
{
code
:
number
,
message
:
string
})
=>
{
console
.
error
(
'
create running lock failed, err:
'
+
err
);
console
.
error
(
'
create running lock failed, err:
'
+
err
);
});
});
```
```
...
@@ -445,11 +445,11 @@ isUsed(): boolean
...
@@ -445,11 +445,11 @@ isUsed(): boolean
```
js
```
js
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
runningLock
.
createRunningLock
(
'
running_lock_test
'
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
lock
=>
{
.
then
(
(
lock
:
runningLock
.
RunningLock
)
=>
{
var
isUsed
=
lock
.
isUsed
();
let
isUsed
=
lock
.
isUsed
();
console
.
info
(
'
check running lock used status:
'
+
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
);
console
.
error
(
'
check running lock used status failed, err:
'
+
err
);
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-system-battery.md
浏览文件 @
7e7c1dd8
...
@@ -33,10 +33,10 @@ getStatus(options?: GetStatusOptions): void;
...
@@ -33,10 +33,10 @@ getStatus(options?: GetStatusOptions): void;
```
js
```
js
battery
.
getStatus
({
battery
.
getStatus
({
success
:
function
(
data
)
{
success
:
(
data
:
BatteryResponse
)
=>
{
console
.
log
(
'
success get battery level:
'
+
data
.
level
);
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
);
console
.
error
(
'
fail to get battery level code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
...
zh-cn/application-dev/reference/apis/js-apis-system-brightness.md
浏览文件 @
7e7c1dd8
...
@@ -34,10 +34,10 @@ getValue(options?: GetBrightnessOptions): void
...
@@ -34,10 +34,10 @@ getValue(options?: GetBrightnessOptions): void
```
js
```
js
brightness
.
getValue
({
brightness
.
getValue
({
success
:
function
(
data
)
{
success
:
(
data
:
BrightnessResponse
)
=>
{
console
.
log
(
'
success get brightness value:
'
+
data
.
value
);
console
.
log
(
'
success get brightness value:
'
+
data
.
value
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
get brightness fail, code:
'
+
code
+
'
, data:
'
+
data
);
console
.
error
(
'
get brightness fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
@@ -63,10 +63,10 @@ setValue(options?: SetBrightnessOptions): void
...
@@ -63,10 +63,10 @@ setValue(options?: SetBrightnessOptions): void
```
js
```
js
brightness
.
setValue
({
brightness
.
setValue
({
value
:
100
,
value
:
100
,
success
:
function
()
{
success
:
()
=>
{
console
.
log
(
'
handling set brightness success.
'
);
console
.
log
(
'
handling set brightness success.
'
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set brightness value fail, code:
'
+
code
+
'
, data:
'
+
data
);
console
.
error
(
'
handling set brightness value fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
@@ -91,10 +91,10 @@ getMode(options?: GetBrightnessModeOptions): void
...
@@ -91,10 +91,10 @@ getMode(options?: GetBrightnessModeOptions): void
```
js
```
js
brightness
.
getMode
({
brightness
.
getMode
({
success
:
function
(
data
)
{
success
:
(
data
:
BrightnessModeResponse
)
=>
{
console
.
log
(
'
success get mode:
'
+
data
.
mode
);
console
.
log
(
'
success get mode:
'
+
data
.
mode
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling get mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
console
.
error
(
'
handling get mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
@@ -119,10 +119,10 @@ setMode(options?: SetBrightnessModeOptions): void
...
@@ -119,10 +119,10 @@ setMode(options?: SetBrightnessModeOptions): void
```
js
```
js
brightness
.
setMode
({
brightness
.
setMode
({
mode
:
1
,
mode
:
1
,
success
:
function
()
{
success
:
()
=>
{
console
.
log
(
'
handling set mode success.
'
);
console
.
log
(
'
handling set mode success.
'
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
console
.
error
(
'
handling set mode fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
@@ -150,10 +150,10 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void
...
@@ -150,10 +150,10 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void
```
js
```
js
brightness
.
setKeepScreenOn
({
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
keepScreenOn
:
true
,
success
:
function
()
{
success
:
()
=>
{
console
.
log
(
'
handling set keep screen on success.
'
);
console
.
log
(
'
handling set keep screen on success.
'
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
(
data
:
string
,
code
:
number
)
=>
{
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
}
});
});
...
...
zh-cn/application-dev/reference/apis/js-apis-thermal.md
浏览文件 @
7e7c1dd8
...
@@ -38,7 +38,7 @@ registerThermalLevelCallback(callback: Callback<ThermalLevel>): void
...
@@ -38,7 +38,7 @@ registerThermalLevelCallback(callback: Callback<ThermalLevel>): void
```
js
```
js
try
{
try
{
thermal
.
registerThermalLevelCallback
(
level
=>
{
thermal
.
registerThermalLevelCallback
(
(
level
:
thermal
.
ThermalLevel
)
=>
{
console
.
info
(
'
thermal level is:
'
+
level
);
console
.
info
(
'
thermal level is:
'
+
level
);
});
});
console
.
info
(
'
register thermal level callback success.
'
);
console
.
info
(
'
register thermal level callback success.
'
);
...
@@ -108,7 +108,7 @@ getLevel(): ThermalLevel
...
@@ -108,7 +108,7 @@ getLevel(): ThermalLevel
```
js
```
js
try
{
try
{
var
level
=
thermal
.
getLevel
();
let
level
=
thermal
.
getLevel
();
console
.
info
(
'
thermal level is:
'
+
level
);
console
.
info
(
'
thermal level is:
'
+
level
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
get thermal level failed, err:
'
+
err
);
console
.
error
(
'
get thermal level failed, err:
'
+
err
);
...
@@ -134,7 +134,7 @@ subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void
...
@@ -134,7 +134,7 @@ subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void
**示例:**
**示例:**
```
js
```
js
thermal
.
subscribeThermalLevel
((
l
evel
)
=>
{
thermal
.
subscribeThermalLevel
((
err
:
BusinessError
<
void
>
,
level
:
thermal
.
ThermalL
evel
)
=>
{
console
.
info
(
'
thermal level is:
'
+
level
);
console
.
info
(
'
thermal level is:
'
+
level
);
});
});
```
```
...
@@ -182,7 +182,7 @@ getThermalLevel(): ThermalLevel
...
@@ -182,7 +182,7 @@ getThermalLevel(): ThermalLevel
**示例:**
**示例:**
```
js
```
js
var
level
=
thermal
.
getThermalLevel
();
let
level
=
thermal
.
getThermalLevel
();
console
.
info
(
'
thermal level is:
'
+
level
);
console
.
info
(
'
thermal level is:
'
+
level
);
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录