Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/accelerometer.js Secret

Created Dec 25, 2013
Embed
What would you like to do?
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