I have a script called "utils.js" that contains multiple functions that can be reused cross multiple files. So how can i convert this function in a way to work in multiple files when is called?
Example:
function myMultiscriptsGetter(pScript){
}
Then in any other script i just need to include the "utils.js" and call the function, like this :
$.myMultiscriptsGetter(pScript).done(function() {
});
Note: I tried this but it doesn't work. I dont have a lot experience with jquery
What I have tried:
Currently, i have this function:
$.getMultiScripts = function(arr, path) {
var _arr = $.map(arr, function(scr) {
return $.getScript( (path||"") + scr );
});
_arr.push($.Deferred(function( deferred ){
$( deferred.resolve );
}));
return $.when.apply($, _arr);
}
Then, is called:
$.getMultiScripts(pScript).done(function() {
});