| Zhiqiang Zhang | 2c41d41 | 2014-09-02 07:50:29 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <meta charset='utf-8'> |
| 3 | <title>Vibration API: cancel ongoing vibrate() with [0]</title> |
| 4 | <link rel='author' title='Intel' href='http://www.intel.com'> |
| 5 | <link rel='help' href='http://dev.w3.org/2009/dap/vibration/#vibration-interface'> |
| 6 | <meta name='flags' content='interact'> |
| 7 | <meta name='assert' content='If pattern contains a single entry with a value of 0, cancel the pre-existing instance of the processing vibration patterns algorithm'> |
| 8 | <style> |
| 9 | button { |
| 10 | height: 100px; |
| 11 | width: 100px; |
| 12 | } |
| 13 | </style> |
| 14 | |
| 15 | <h1>Description</h1> |
| 16 | <p> |
| 17 | After hitting the button below, your device must vibrate for a short period of time (roughly one |
| 18 | second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then |
| 19 | the test has failed. |
| 20 | </p> |
| 21 | <button id='vib'>Vibrate!</button> |
| Zhiqiang Zhang | 2c41d41 | 2014-09-02 07:50:29 | [diff] [blame] | 22 | <script> |
| 23 | if (undefined !== navigator.vibrate) { |
| 24 | document.getElementById('vib').onclick = function () { |
| 25 | navigator.vibrate(5000); |
| 26 | setTimeout(function () { |
| 27 | navigator.vibrate([0]); |
| 28 | }, 1000); |
| 29 | }; |
| 30 | } |
| 31 | </script> |