public
Created

Phonegap 1.5/Cordova Lazy Load Test

  • Download Gist
index.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 
<script src="https://raw.github.com/jbrantly/yabble/master/lib/yabble.js"></script>
<script src="js/jquery.js"></script>
 
</head>
<body>
<button id="loadPhonegap">Load Phonegap</button>
<button id="checkDevice">Check Device</button>
<button id="callPlugin">Call Plugin</button>
<div id="console">
</div>
<script>
require.setModuleRoot("js");
require.useScriptTags();
 
$("#loadPhonegap").click(function(){
require.ensure([ "cordova-1.5.0" ], function(req) {
 
req.ensure([ "plugin1" ], function() {
$("#console").append("Plugin1 loaded<br>");
});
});
});
 
// Check PhoneGap Device object
$("#checkDevice").click(function() {
console.log(JSON.stringify(device));
});
// Call PhoneGap Plugin
$("#callPlugin").click(function() {
window.plugins.plugin1.call();
});
</script>
</body>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.