PhoneGap TextMate Bundle | November 22nd, 2010
Dear TextMate users/PhoneGap developers,
I put together a little bundle for your favorite editor. You should now be able to easily get code snippets right in your editor.
You can find it here
Installation instructions are here
How to use:
Type accel.wa and press Tab and you should get:
function onSuccess(acceleration) {
alert('Acceleration X: ' + acceleration.x + '\n' +
'Acceleration Y: ' + acceleration.y + '\n' +
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
};
function onError() {
alert('onError!');
};
var options = { frequency: 3000 }; // Update every 3 seconds
var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
Now all you have to do is modify the callbacks to suit your needs! Almost every API method should be present.
Feedback always welcome!