Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c70f8f0c
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看板
提交
c70f8f0c
编写于
4月 26, 2023
作者:
L
li-yaoyao777
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改docs资料
Signed-off-by:
N
li-yaoyao777
<
liyaoyao7@huawei.com
>
上级
57296b34
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
51 deletion
+51
-51
zh-cn/application-dev/reference/apis/js-apis-sensor.md
zh-cn/application-dev/reference/apis/js-apis-sensor.md
+41
-41
zh-cn/application-dev/reference/apis/js-apis-vibrator.md
zh-cn/application-dev/reference/apis/js-apis-vibrator.md
+10
-10
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-sensor.md
浏览文件 @
c70f8f0c
...
...
@@ -49,7 +49,7 @@ try {
console
.
info
(
'
X-coordinate component:
'
+
data
.
x
);
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -92,7 +92,7 @@ try {
console
.
info
(
'
X-coordinate bias:
'
+
data
.
biasX
);
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -128,7 +128,7 @@ on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, option
try
{
sensor
.
on
(
sensor
.
SensorId
.
AMBIENT_LIGHT
,
function
(
data
)
{
console
.
info
(
'
The ambient light intensity:
'
+
data
.
intensity
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -164,7 +164,7 @@ on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureR
try
{
sensor
.
on
(
sensor
.
SensorId
.
AMBIENT_TEMPERATURE
,
function
(
data
)
{
console
.
info
(
'
Temperature:
'
+
data
.
temperature
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -200,7 +200,7 @@ on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, option
try
{
sensor
.
on
(
sensor
.
SensorId
.
BAROMETER
,
function
(
data
)
{
console
.
info
(
'
Atmospheric pressure:
'
+
data
.
pressure
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -238,7 +238,7 @@ try {
console
.
info
(
'
X-coordinate component:
'
+
data
.
x
);
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -278,7 +278,7 @@ try {
console
.
info
(
'
X-coordinate component:
'
+
data
.
x
);
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -322,7 +322,7 @@ try {
console
.
info
(
'
X-coordinate bias:
'
+
data
.
biasX
);
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -358,7 +358,7 @@ on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Option
try
{
sensor
.
on
(
sensor
.
SensorId
.
HALL
,
function
(
data
)
{
console
.
info
(
'
Hall status:
'
+
data
.
status
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -396,7 +396,7 @@ on(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>,option
try
{
sensor
.
on
(
sensor
.
SensorId
.
HEART_RATE
,
function
(
data
)
{
console
.
info
(
'
Heart rate:
'
+
data
.
heartRate
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -432,7 +432,7 @@ on(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>,options?:
try
{
sensor
.
on
(
sensor
.
SensorId
.
HUMIDITY
,
function
(
data
)
{
console
.
info
(
'
Humidity:
'
+
data
.
humidity
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -473,7 +473,7 @@ try {
console
.
info
(
'
X-coordinate component:
'
+
data
.
x
);
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -511,7 +511,7 @@ try {
console
.
info
(
'
X-coordinate component:
'
+
data
.
x
);
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -552,7 +552,7 @@ try {
console
.
info
(
'
X-coordinate bias:
'
+
data
.
biasX
);
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -590,7 +590,7 @@ try {
console
.
info
(
'
The device rotates at an angle around the Z axis:
'
+
data
.
alpha
);
console
.
info
(
'
The device rotates at an angle around the X axis:
'
+
data
.
beta
);
console
.
info
(
'
The device rotates at an angle around the Y axis:
'
+
data
.
gamma
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -628,7 +628,7 @@ on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, option
try
{
sensor
.
on
(
sensor
.
SensorId
.
PEDOMETER
,
function
(
data
)
{
console
.
info
(
'
Step count:
'
+
data
.
steps
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -667,7 +667,7 @@ on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionR
try
{
sensor
.
on
(
sensor
.
SensorId
.
PEDOMETER_DETECTION
,
function
(
data
)
{
console
.
info
(
'
Pedometer scalar:
'
+
data
.
scalar
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -703,7 +703,7 @@ on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, option
try
{
sensor
.
on
(
sensor
.
SensorId
.
PROXIMITY
,
function
(
data
)
{
console
.
info
(
'
Distance:
'
+
data
.
distance
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -743,7 +743,7 @@ try {
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
console
.
info
(
'
Scalar quantity:
'
+
data
.
w
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -780,7 +780,7 @@ on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionRes
try
{
sensor
.
on
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
,
function
(
data
)
{
console
.
info
(
'
Scalar data:
'
+
data
.
scalar
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -817,7 +817,7 @@ on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>
try
{
sensor
.
on
(
sensor
.
SensorId
.
WEAR_DETECTION
,
function
(
data
)
{
console
.
info
(
'
Wear status:
'
+
data
.
value
);
},
{
interval
:
10000000
});
},
{
interval
:
10000000
0
});
}
catch
(
err
)
{
console
.
error
(
'
On fail, errCode:
'
+
err
.
code
+
'
,msg:
'
+
err
.
message
);
}
...
...
@@ -3851,7 +3851,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<Acceler
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type |
[
SensorType
](
#sensortype
)
.SENSOR_TYPE_ID_ACCELEROMETER | 是 | 要订阅的加速度传感器类型为SENSOR_TYPE_ID_ACCELEROMETER。 |
| callback | Callback
<
[AccelerometerResponse](#accelerometerresponse)
>
| 是 | 注册加速度传感器的回调函数,上报的数据类型为AccelerometerResponse。 |
| options |
[
Options
](
#options
)
| 否 | 可选参数列表
列表
,设置上报频率,默认值为200000000ns。 |
| options |
[
Options
](
#options
)
| 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:**
...
...
@@ -3861,7 +3861,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<Acceler
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -3915,7 +3915,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -3945,7 +3945,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityRespons
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -3976,7 +3976,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeRes
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4010,7 +4010,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Callback<G
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4037,7 +4037,7 @@ on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<Sig
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_SIGNIFICANT_MOTION
,
function
(
data
){
console
.
info
(
'
Scalar data:
'
+
data
.
scalar
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4066,7 +4066,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<Pe
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER_DETECTION
,
function
(
data
){
console
.
info
(
'
Scalar data:
'
+
data
.
scalar
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4095,7 +4095,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerRes
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER
,
function
(
data
){
console
.
info
(
'
Steps:
'
+
data
.
steps
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4123,7 +4123,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:Callback<Ambi
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_TEMPERATURE
,
function
(
data
){
console
.
info
(
'
Temperature:
'
+
data
.
temperature
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4153,7 +4153,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<Magneti
console
.
info
(
'
Y-coordinate component:
'
+
data
.
y
);
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4185,7 +4185,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callbac
console
.
info
(
'
Y-coordinate bias:
'
+
data
.
biasY
);
console
.
info
(
'
Z-coordinate bias:
'
+
data
.
biasZ
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4212,7 +4212,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityRes
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PROXIMITY
,
function
(
data
){
console
.
info
(
'
Distance:
'
+
data
.
distance
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4240,7 +4240,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityRespo
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HUMIDITY
,
function
(
data
){
console
.
info
(
'
Humidity:
'
+
data
.
humidity
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4268,7 +4268,7 @@ on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerRes
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_BAROMETER
,
function
(
data
){
console
.
info
(
'
Atmospheric pressure:
'
+
data
.
pressure
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4295,7 +4295,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>,
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
function
(
data
){
console
.
info
(
'
Status:
'
+
data
.
status
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4323,7 +4323,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightRes
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
function
(
data
){
console
.
info
(
'
Illumination:
'
+
data
.
intensity
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4352,7 +4352,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<Orientatio
console
.
info
(
'
The device rotates at an angle around the Y axis:
'
+
data
.
gamma
);
console
.
info
(
'
The device rotates at an angle around the Z axis:
'
+
data
.
alpha
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4401,7 +4401,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback: Callback<Rotatio
console
.
info
(
'
Z-coordinate component:
'
+
data
.
z
);
console
.
info
(
'
Scalar quantity:
'
+
data
.
w
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
@@ -4428,7 +4428,7 @@ on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDet
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_WEAR_DETECTION
,
function
(
data
){
console
.
info
(
'
Wear status:
'
+
data
.
value
);
},
{
interval
:
10000000
}
{
interval
:
10000000
0
}
);
```
...
...
zh-cn/application-dev/reference/apis/js-apis-vibrator.md
浏览文件 @
c70f8f0c
...
...
@@ -52,7 +52,7 @@ try {
usage
:
'
alarm
'
},
(
error
)
=>
{
if
(
error
)
{
console
.
error
(
'
v
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
console
.
error
(
'
V
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
return
;
}
console
.
log
(
'
Callback returned to indicate a successful vibration.
'
);
...
...
@@ -129,7 +129,7 @@ stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback<void>):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------------------------------ |
| stopMode |
[
VibratorStopMode
](
#vibratorstopmode
)
| 是 | 指定的停止振动模式。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
。
当马达停止振动成功,err为undefined,否则为错误对象。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
,
当马达停止振动成功,err为undefined,否则为错误对象。 |
**示例:**
...
...
@@ -145,7 +145,7 @@ try {
usage
:
'
alarm
'
},
(
error
)
=>
{
if
(
error
)
{
console
.
error
(
'
v
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
console
.
error
(
'
V
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
return
;
}
console
.
log
(
'
Callback returned to indicate a successful vibration.
'
);
...
...
@@ -237,7 +237,7 @@ stopVibration(callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
。
当马达停止振动成功,err为undefined,否则为错误对象。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
,
当马达停止振动成功,err为undefined,否则为错误对象。 |
**示例:**
...
...
@@ -253,7 +253,7 @@ try {
usage
:
'
alarm
'
},
(
error
)
=>
{
if
(
error
)
{
console
.
error
(
'
v
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
console
.
error
(
'
V
ibrate fail, error.code:
'
+
error
.
code
+
'
error.message:
'
,
+
error
.
message
);
return
;
}
console
.
log
(
'
Callback returned to indicate a successful vibration.
'
);
...
...
@@ -338,7 +338,7 @@ isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------------------------------ |
| effectId | string | 是 | 振动效果id |
| callback | AsyncCallback
<
boolean
>
| 是 | 回调函数
。
当返回true则表示支持该effectId,否则不支持。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 回调函数
,
当返回true则表示支持该effectId,否则不支持。 |
**示例:**
...
...
@@ -419,7 +419,7 @@ try {
console
.
error
(
'
Promise returned to indicate a failed vibration:
'
+
JSON
.
stringify
(
error
));
});
}
catch
(
error
)
{
console
.
error
(
'
e
xception in, error:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
E
xception in, error:
'
+
JSON
.
stringify
(
error
));
}
}
},
(
error
)
=>
{
...
...
@@ -566,7 +566,7 @@ vibrate(duration: number, callback?: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------------------------- |
| duration | number | 是 | 马达振动时长, 单位ms。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
。
当马达振动成功,err为undefined,否则为错误对象。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
,
当马达振动成功,err为undefined,否则为错误对象。 |
**示例:**
...
...
@@ -633,7 +633,7 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------------------------- |
| effectId |
[
EffectId
](
#effectid
)
| 是 | 预置的振动效果ID。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
。
当马达振动成功,err为undefined,否则为错误对象。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
,
当马达振动成功,err为undefined,否则为错误对象。 |
**示例:**
...
...
@@ -708,7 +708,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------------------------------ |
| stopMode |
[
VibratorStopMode
](
#vibratorstopmode
)
| 是 | 马达停止指定的振动模式。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
。
当马达停止振动成功,err为undefined,否则为错误对象。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数
,
当马达停止振动成功,err为undefined,否则为错误对象。 |
**示例:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录