cancel-with-empty-array-manual.html (1123B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset='utf-8'/> 5 <title>Vibration API: cancel ongoing vibrate() with []</title> 6 <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> 7 <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> 8 <meta name='flags' content='dom, interact'/> 9 <meta name='assert' content='If pattern is an empty list, cancel the pre-existing instance of the processing vibration patterns algorithm'/> 10 </head> 11 <body> 12 <h1>Description</h1> 13 <p> 14 After hitting the button below, your device must vibrate for a short period of time (roughly one 15 second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then 16 the test has failed. 17 </p> 18 <button id='vib'>Vibrate!</button> 19 <script> 20 if (undefined !== navigator.vibrate) { 21 document.getElementById("vib").onclick = function () { 22 navigator.vibrate(5000); 23 setTimeout(function () { 24 navigator.vibrate([]); 25 }, 1000); 26 }; 27 } 28 </script> 29 </body> 30 </html>