| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 1 | <!DOCTYPE html> |
| Zhiqiang Zhang | 2f202f4 | 2014-06-24 14:28:53 | [diff] [blame] | 2 | <html> |
| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 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'/> |
| Dominique Hazael-Massieux | c3911b9 | 2014-03-10 11:05:20 | [diff] [blame] | 8 | <meta name='flags' content='dom, interact'/> |
| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 9 | <meta name='assert' content='Cancel the pre-existing instance of the processing vibration patterns algorithm, if any.'/> |
| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 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> |
| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 20 | <script> |
| Dominique Hazael-Massieux | c3911b9 | 2014-03-10 11:05:20 | [diff] [blame] | 21 | if (undefined !== navigator.vibrate) { |
| Dominique Hazael-Massieux | f69fc72 | 2013-05-30 12:31:40 | [diff] [blame] | 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> |