Did you know that you can make your phone vibrate with javascript?⁣

0
2041
vibrate-phone-with-javascript
vibrate-phone-with-javascript

There is a Vibration API. It is pretty easy to use!⁣

You can use it on every device that has a vibration motor in them. Like your phone! ⁣

You can even programme pattern. So you just don’t have one long vibration.

Syntex

window.navigator.vibrate(pattern);

pattern : pattern is numeric value or numeric Array. pattern of vibration and pause intervals. you can pass single value to vibrate for that many milliseconds.

Example

window.navigator.vibrate(100)  // vibrate for 100 milliseconds

window.navigator.vibrate([100])  // the same thing as above

window.navigator.vibrate([100,50,100,200])  // vibrate on given patter 

window.navigator.vibrate(0)  // you can cancel the vibration by passing 0

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here