Skip to content

Instantly share code, notes, and snippets.

@videlais
Created December 25, 2013 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save videlais/feef57ce4c986bfdcc8f to your computer and use it in GitHub Desktop.
Save videlais/feef57ce4c986bfdcc8f to your computer and use it in GitHub Desktop.
Accelerometer1
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