Hi,
I'm a little confused about the best practice to achieve the following: I have an object which requires the load of 2 JS libraries(jQuery and swfobject), who may be already loaded or not, so i have to check both before calling the final method (output). Another tricky thing is that i have to pass some arguments to the initial method (gen) and those args must pass to output. Should i use .apply?
var myfancymethod = {
zclk: "string1",
zclk2: "string2",
loadsrc: function(what){
jQuery.getScript(what, function() {
alert (what+ "loaded");
});
},
checklibs: function(){
if (typeof libA == "undefined") {
this.loadsrc("libA.js");
}
if (typeof libB == "undefined") {
this.loadsrc("libB.js");
}
},
output: function (a, b, c){
//final output here
},
gen: function(a, b, c, d){
//have to check if libray A and B are loaded
this.checklibs();
//call to output()
?
}
myfancymethod.gen(a, b, c, d );