blob: 64e6e9b548233809b217c03e2709f7fbf12fdce9 [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 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'/>
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='Cancel the pre-existing instance of the processing vibration patterns algorithm, if any.'/>
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 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>
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:4020 <script>
Dominique Hazael-Massieuxc3911b92014-03-10 11:05:2021 if (undefined !== navigator.vibrate) {
Dominique Hazael-Massieuxf69fc722013-05-30 12:31:4022 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>