Skip to content

Instantly share code, notes, and snippets.

@dhavaln
Created March 12, 2012 09:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhavaln/2020837 to your computer and use it in GitHub Desktop.
Save dhavaln/2020837 to your computer and use it in GitHub Desktop.
Phonegap 1.5/Cordova Lazy Load Test
<!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>
@BrixSat
Copy link

BrixSat commented Oct 3, 2018

What about lazyloading the java part of the plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment