Skip to content

Instantly share code, notes, and snippets.

@anurag619
Created March 19, 2014 12:39
Show Gist options
  • Save anurag619/9640840 to your computer and use it in GitHub Desktop.
Save anurag619/9640840 to your computer and use it in GitHub Desktop.
the HTML file for Shake gesture detection (in PhoneGap / Cordova) [https://gist.github.com/leecrossley/4078996]
<!DOCTYPE html>
<html>
<head>
<title>Shake Test</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="shake.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to connect with the device
//
document.addEventListener("deviceready",onDeviceReady,false);
// Cordova is ready to be used!
//
function onDeviceReady() {
var element = document.getElementById('deviceIsReady');
element.innerHTML = 'Watching shake movement...';
shake.startWatch(onShake);
}
function onShake() {
var element = document.getElementById('shakeData');
element.innerHTML = 'It\'s happening!'
}
</script>
</head>
<body>
<div id="deviceIsReady">Loading...</div>
<p id="shakeData"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment