cancel-with-new-manual.html (1289B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset='utf-8'/> 5 <title>Vibration API: cancel ongoing vibrate() with a new call to vibrate</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='Cancel the pre-existing instance of the processing vibration patterns algorithm, if any.'/> 10 </head> 11 <body> 12 <h1>Description</h1> 13 <p> 14 After hitting the button below, your device must vibrate continuously for a short period of time (roughly one 15 second), then vibrate a series of short bursts. If the initial continuously vibration is longer (roughly five 16 seconds, it should feel somewhat long) or if there is no series of short vibration bursts then the test has 17 failed. 18 </p> 19 <button id='vib'>Vibrate!</button> 20 <script> 21 if (undefined !== navigator.vibrate) { 22 document.getElementById("vib").onclick = function () { 23 navigator.vibrate(5000); 24 setTimeout(function () { 25 navigator.vibrate([200, 200, 200, 200, 200, 200, 200, 200, 200]); 26 }, 1000); 27 }; 28 } 29 </script> 30 </body> 31 </html>