Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <script language="JavaScript">
  5. window.onload = () => {
  6. const h = document.getElementById('h');
  7. const a = document.getElementById('a');
  8. const b = document.getElementById('b');
  9. const g = document.getElementById('g');
  10. window.addEventListener('deviceorientation', (e) => {
  11. const {
  12. webkitCompassHeading
  13. , alpha
  14. , beta
  15. , gamma
  16. } = e;
  17.  
  18. h.innerText = `webkitCompassHeading: ${webkitCompassHeading}`;
  19. a.innerText = `alpha: ${alpha}`;
  20. b.innerText = `beta: ${beta}`;
  21. g.innerText = `gamma: ${gamma}`;
  22. })
  23. }
  24. </script>
  25. <body>
  26. <h1 id="h"></h1>
  27. <h3 id="a"></h3>
  28. <h3 id="b"></h3>
  29. <h3 id="g"></h3>
  30.  
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement