I'm developing a plugin that makes use of two other plugins. I was planning on using .getScript() to load the other two scripts, but I'm wondering how best to do this. Specifically, if the call is async, how can I guarantee that the scripts are loaded before the plugin is initialized? Would it be smarter to make the calls not async? (Is that possible? )
Code:
(function($){
// Is this the right place?
$.getScript('plugin1.js', function() {});
$.getScript('plugin2.js', function() {});
// Plugin stuff:
$.fn.myPlugin = function() {
return this.each(function() {
// Dependent plugins better be loaded by this point!
}); // End of this.each(...)
}; // End of plugin
})(jQuery); // End of closure
Thanks-