UADetect vibrate Method
Description
Does two things:
- Vibrates the device, if compatible hardware is available. This returns
success, and if not - Returns
failure, if the function fails for any reason
Arguments
Takes one mandatory argument. This is the pattern to vibrate for (in miliseconds per vibration) and has to be the type number | number[]
Possible Returns
successfailure
Usage Example
import { vibrate } from 'uadetect'// Vibrate SOS in morse codevibrate([100,30,100,30,100,30,200,30,200,30,200,30,100,30,100,30,100])if (vibrate === 'success') { // Operation was a success // Do something...} else { // Operation was a failure // Maybe send a notification?}Note:
Note:
vibratedoes not work on Safari on any platform.- It also has some compatibility issues on Firefox for Android.
- It will only
console.errorif it is used on Safari.
Table of Contents
