未验证 提交 8de07c9b 编写于 作者: O openharmony_ci 提交者: Gitee

!7692 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】update...

!7692 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】update zh-cn/application-dev/device/sensor-guidelines.md.注释格式修改
Merge pull request !7692 from 李贤/N/A
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
``` ```
import sensor from "@ohos.sensor" import sensor from "@ohos.sensor"
sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){ sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){
console.info("Subscription succeeded. data = " + data);//调用成功,打印对应传感器的数据 console.info("Subscription succeeded. data = " + data);// 调用成功,打印对应传感器的数据
} }
); );
``` ```
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
``` ```
import sensor from "@ohos.sensor" import sensor from "@ohos.sensor"
sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() { sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() {
console.info("Succeeded in unsubscribing from acceleration sensor data.");//注销成功,返回打印结果 console.info("Succeeded in unsubscribing from acceleration sensor data.");// 注销成功,返回打印结果
} }
); );
``` ```
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
``` ```
import sensor from "@ohos.sensor" import sensor from "@ohos.sensor"
sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) {
console.info("Data obtained successfully. data=" + data);//获取数据成功,打印对应传感器的数据 console.info("Data obtained successfully. data=" + data);// 获取数据成功,打印对应传感器的数据
} }
); );
``` ```
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
``` ```
try { try {
sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) {
console.info("Data obtained successfully. data=" + data);//获取数据成功,打印对应传感器的数据 console.info("Data obtained successfully. data=" + data);// 获取数据成功,打印对应传感器的数据
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册