combinationLockPG/main.js

19 lines
519 B
JavaScript
Raw Normal View History

2014-03-16 11:30:15 +00:00
var onSuccess = function(heading) {
2014-03-11 08:24:07 +00:00
var element = document.getElementById('heading');
2014-03-17 21:24:08 +00:00
element.innerHTML = 'Heading: ' + heading.magneticHeading;
drawDial(heading.magneticHeading*Math.PI/180);
2014-03-11 08:24:07 +00:00
};
var onErrors = function() {
2014-03-17 21:24:08 +00:00
alert('Compass error: ' + compassError.code);
2014-03-11 08:24:07 +00:00
};
var startup = function(){
2014-03-17 21:24:08 +00:00
watchID = navigator.compass.watchHeading(onSuccess, onErrors, options);
2014-03-11 08:24:07 +00:00
lockinit();
}
2014-03-17 21:24:08 +00:00
var watchID = null;
var options = { frequency: 1000 };
document.addEventListener("deviceready", startup, false);