diff --git a/zh-cn/application-dev/device/vibrator-guidelines.md b/zh-cn/application-dev/device/vibrator-guidelines.md index 20248b8fb97aca66337b08c030a9ac29857f47b6..4aae5a17404baa8ae95e5e11138b6e02bb046aed 100644 --- a/zh-cn/application-dev/device/vibrator-guidelines.md +++ b/zh-cn/application-dev/device/vibrator-guidelines.md @@ -26,36 +26,36 @@ ``` "reqPermissions": [ - { - "name": "ohos.permission.ACCELEROMETER", - "reason": "", - "usedScene": { - "ability": [ - ".MainAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.VIBRATE", - "reason": "", - "usedScene": { - "ability": [ - ".MainAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.ACTIVITY_MOTION", - "reason": "", - "usedScene": { - "ability": [ - ".MainAbility" - ], - "when": "inuse" - } - }, + { + "name": "ohos.permission.ACCELEROMETER", + "reason": "", + "usedScene": { + "ability": [ + ".MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.VIBRATE", + "reason": "", + "usedScene": { + "ability": [ + ".MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.ACTIVITY_MOTION", + "reason": "", + "usedScene": { + "ability": [ + ".MainAbility" + ], + "when": "inuse" + } + }, ] ``` @@ -63,12 +63,12 @@ ``` import vibrator from "@ohos.vibrator" - vibrator.vibrate(1000).then((error)=>{ - if(error){//调用失败,打印error.code和error.message - Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); - }else{//调用成功,设备开始振动 + vibrator.vibrate(1000).then((error) => { + if (error) { //调用失败,打印error.code和error.message + Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message); + } else { //调用成功,设备开始振动 Console.log("Promise returned to indicate a successful vibration.") - }; + } }) ``` @@ -76,12 +76,12 @@ ``` import vibrator from "@ohos.vibrator" - vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ - if(error){//调用失败,打印error.code和error.message - Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); - }else{//调用成功,设备停止振动 + vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error) => { + if (error) { //调用失败,打印error.code和error.message + Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message); + } else { //调用成功,设备停止振动 Console.log("Promise returned to indicate successful."); - }; + } }) ```