I'm using the $.getScript
to load a jQuery plugin in my own plugin. The problem is that I can only access the loaded plugin and instantiate an object in the callback function of the $.getScript
method.
I would like to know if there is a way to do the instantiation outside of the callback function. See the actual implementation in the following code:
init = function( options ) {
$.getScript('javascript/lib/fullcalendar-1.5.3/fullcalendar/fullcalendar.js', function() {
// Instantiation is require to be done here
self.fullCalendar(options);
});
self.opt = $.extend(true, {}, defaults, options);
self.data('settings', self.opt);
if (typeof options.test === 'function') {
// I would liked to do this here but at this point fullcalendar is not defined
self.fullcalendar(options);
var tests = test.call(self, 3, 1);
options.test.call(self, tests, null);
}
}