Created
March 19, 2014 12:39
-
-
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]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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