Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 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 src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> |
| 21 | <script> |
| 22 | if (undefined !== navigator.vibrate) { |
| 23 | document.getElementById("vib").onclick = function () { |
| 24 | navigator.vibrate(5000); |
| 25 | setTimeout(function () { |
| 26 | navigator.vibrate([200, 200, 200, 200, 200, 200, 200, 200, 200]); |
| 27 | }, 1000); |
| 28 | }; |
| 29 | } |
| 30 | </script> |
| 31 | </body> |
| 32 | </html> |