提交 aa3a9915 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 bb4603ba
...@@ -20,38 +20,38 @@ You can set different vibration effects as needed, for example, customizing the ...@@ -20,38 +20,38 @@ You can set different vibration effects as needed, for example, customizing the
## How to Develop ## How to Develop
1. Declare the permissions required for controlling vibrators on the hardware device in the **config.json** file. 1. Declare the permissions required for controlling vibrators on the hardware device in the `config.json` file.
``` ```
"reqPermissions":[ "reqPermissions": [
{ {
"name":"ohos.permission.ACCELEROMETER", "name": "ohos.permission.ACCELEROMETER",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability""[ "ability": [
".MainAbility" ".MainAbility"
], ],
"when":"inuse" "when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.VIBRATE", "name": "ohos.permission.VIBRATE",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability""[ "ability": [
".MainAbility" ".MainAbility"
], ],
"when":"inuse" "when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.ACTIVITY_MOTION", "name": "ohos.permission.ACTIVITY_MOTION",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability""[ "ability": [
".MainAbility" ".MainAbility"
], ],
"when":"inuse" "when": "inuse"
} }
}, },
] ]
...@@ -77,7 +77,7 @@ You can set different vibration effects as needed, for example, customizing the ...@@ -77,7 +77,7 @@ You can set different vibration effects as needed, for example, customizing the
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{
if(error){ // The call fails, and error.code and error.message are printed. if(error){ // The call fails, and error.code and error.message are printed.
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message);
}else{ // The call is successful, and the device stops vibration. }else{ // The call is successful, and the device stops vibrating.
Console.log("Promise returned to indicate a successful stop."); Console.log("Promise returned to indicate a successful stop.");
}; };
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册