Skip to content

Instantly share code, notes, and snippets.

@leosoto
Last active December 20, 2015 12:09
Show Gist options
  • Select an option

  • Save leosoto/6129136 to your computer and use it in GitHub Desktop.

Select an option

Save leosoto/6129136 to your computer and use it in GitHub Desktop.
<html>
<head>
<script charset="utf-8" src="cordova-2.2.0.js"></script>
<script>
// HTML Presenter Javascript API Shortcuts
HtmlPresenter = {
sync: function() { cordova.exec("HtmlPresenter.sync"); },
showMenu: function() { cordova.exec("HtmlPresenter.showMenu"); },
loadApp: function(uri) { cordova.exec("HtmlPresenter.loadApp", uri); },
webViewOpts: function(bounce, zoom) {
cordova.exec("HtmlPresenter.webViewOpts", bounce, zoom); },
deletePresentation: function() {
cordova.exec("HtmlPresenter.deletePresentation"); },
showPresentation: function(presentationName) {
cordova.exec("HtmlPresenter.showPresentation", presentationName); },
requestWhenOnline: function(url) {
cordova.exec("HtmlPresenter.requestWhenOnline", url);},
};
function test(type) {
if (!type) type = "test"
url =
"http://request-when-online-server.herokuapp.com/" + type +
"/client_test?timestamp=" + (new Date()).toISOString() +
"&random=" + Math.random();
HtmlPresenter.requestWhenOnline(url);
document.getElementById("log").innerHTML += ("\n" + url);
}
</script>
</head>
<body>
<a href="javascript:test()">Tap to make a TEST request</a>
<a href="javascript:test('error')">Tap to make a ERROR request</a>
<a href="javascript:test('random')">Tap to make a RANDOM request</a>
<pre id="log"></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment