combinationLockPG/main.js

20 lines
526 B
JavaScript
Raw Normal View History

2014-03-18 07:30:57 +00:00
function onSuccess(acceleration) {
alert('Acceleration X: ' + acceleration.x + '\n' +
'Acceleration Y: ' + acceleration.y + '\n' +
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
2014-03-11 08:24:07 +00:00
};
2014-03-18 07:30:57 +00:00
function onError() {
alert('onError!');
2014-03-11 08:24:07 +00:00
};
var startup = function(){
2014-03-18 07:30:57 +00:00
watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError);
2014-03-11 08:24:07 +00:00
lockinit();
}
2014-03-17 21:24:08 +00:00
2014-03-18 07:30:57 +00:00
2014-03-17 21:24:08 +00:00
var options = { frequency: 1000 };
document.addEventListener("deviceready", startup, false);