OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <title>DeviceMotion all-null event test</title> | |
4 <script type="text/javascript"> | |
5 function checkMotionEvent(event) { | |
6 return event.acceleration.x == null && | |
7 event.acceleration.y == null && | |
8 event.acceleration.z == null && | |
9 event.accelerationIncludingGravity.x == null && | |
10 event.accelerationIncludingGravity.y == null && | |
11 event.accelerationIncludingGravity.z == null && | |
12 event.rotationRate.alpha == null && | |
13 event.rotationRate.beta == null && | |
14 event.rotationRate.gamma == null; | |
15 } | |
16 | |
17 function onMotion(event) { | |
18 if (checkMotionEvent(event)) { | |
19 window.removeEventListener('devicemotion', onMotion); | |
mlamouri (slow - plz ping)
2014/04/04 13:47:07
That sounds odd. Shouldn't you always remove the e
timvolodine
2014/04/04 18:03:18
Hmm, yes that sounds better indeed, I've updated t
| |
20 pass(); | |
21 } else { | |
22 fail(); | |
23 } | |
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 alert("suspend active DOM objects"); | |
37 </script> | |
38 </head> | |
39 <body> | |
40 <div id="status">FAIL</div> | |
41 </body> | |
42 </html> | |
OLD | NEW |