Skip to content

Instantly share code, notes, and snippets.

@alunny
Created May 25, 2012 21:47
Show Gist options
  • Save alunny/2790786 to your computer and use it in GitHub Desktop.
Save alunny/2790786 to your computer and use it in GitHub Desktop.
resume and online events
<html>
<head></head>
<body>
<h1>Resume and Online Events Demo</h1>
<p>alerts should appear on these events</p>
</body>
<script src="phonegap.js"></script>
<script>
document.addEventListener('deviceready', function (e) {
document.addEventListener('resume', onResume, false);
function onResume() {
setTimeout(function() {
document.addEventListener("online", onOnline, false);
alert("resume");
}, 0);
}
function onOnline() {
setTimeout(function() {
alert("online");
}, 0);
}
}, false);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment