DEV Community

Discussion on: Add vibration to your web applications

Collapse
 
alangdm profile image
Alan Dávalos

Or with optional chaining even better to

window?.navigator?.vibrate?.([200,100,200]);
Collapse
 
aminnairi profile image
Amin

Beware that this is still in experimental support! So if the browser does not support this syntax this will throw an error.

But I would of course use this syntax if I was using a transpirer for instance. Really shorten the syntax and looks nice!

Thread Thread
 
alangdm profile image
Alan Dávalos

Sure, then again the browsers that support vibrate and actually vibrate support it so for the most part it's harmless