OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <title>DeviceMotion all-null event test</title> |
| 4 </head> |
| 5 <body> |
| 6 <div id="status">FAIL</div> |
| 7 </body> |
| 8 <script type="text/javascript"> |
| 9 function checkMotionEvent(event) { |
| 10 return event.acceleration.x == null && |
| 11 event.acceleration.y == null && |
| 12 event.acceleration.z == null && |
| 13 event.accelerationIncludingGravity.x == null && |
| 14 event.accelerationIncludingGravity.y == null && |
| 15 event.accelerationIncludingGravity.z == null && |
| 16 event.rotationRate.alpha == null && |
| 17 event.rotationRate.beta == null && |
| 18 event.rotationRate.gamma == null; |
| 19 } |
| 20 |
| 21 function onMotion(event) { |
| 22 window.removeEventListener('devicemotion', onMotion); |
| 23 checkMotionEvent(event) ? pass() : fail(); |
| 24 } |
| 25 |
| 26 function pass() { |
| 27 document.getElementById('status').innerHTML = 'PASS'; |
| 28 document.location = '#pass'; |
| 29 } |
| 30 |
| 31 function fail() { |
| 32 document.location = '#fail'; |
| 33 } |
| 34 |
| 35 window.addEventListener('devicemotion', onMotion); |
| 36 </script> |
| 37 </html> |
OLD | NEW |