-
-
Save videlais/feef57ce4c986bfdcc8f to your computer and use it in GitHub Desktop.
Accelerometer1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Accelerometer = function() { | |
... | |
if (!!window.DeviceMotionEvent) { | |
window.addEventListener("devicemotion", handleMotion, true); | |
self.supported = true; | |
} | |
if (!!window.DeviceOrientationEvent) { | |
window.addEventListener("deviceorientation", handleOrientation, true); | |
self.supported = true; | |
} | |
window.addEventListener("compassneedscalibration", function(event) { | |
self.supported = true; | |
alert('Your compass needs calibrating!'); | |
event.preventDefault(); | |
}, true); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment