blob: 86981c11f859b529d536f3a76eff756826eb32ad [file] [log] [blame]
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:401<!DOCTYPE html>
Zhiqiang Zhang2f202f42014-06-24 14:28:532<html>
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:403 <head>
4 <meta charset='utf-8'/>
5 <title>Vibration API: cancel ongoing vibrate() with 0</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'/>
Dominique Hazael-Massieuxc3911b92014-03-10 11:05:208 <meta name='flags' content='dom, interact'/>
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:409 <meta name='assert' content='If pattern is 0, cancel the pre-existing instance of the processing vibration patterns algorithm'/>
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:4010 </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>
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:4019 <script>
Dominique Hazael-Massieuxc3911b92014-03-10 11:05:2020 if (undefined !== navigator.vibrate) {
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:4021 document.getElementById("vib").onclick = function () {
22 navigator.vibrate(5000);
23 setTimeout(function () {
24 navigator.vibrate(0);
25 }, 1000);
26 };
27 }
28 </script>
29 </body>
30</html>