Use the cache if your server allows it to increase speed.
var extern =(url)=> { // load extern javascript let scr = $.extend({}, { dataType: 'script', cache: true, url: url }); return $.ajax(scr); } function ext(file, func) { extern(file).done(func); // calls a function from an extern javascript file }
And then use it like this:
ext('somefile.js',()=> myFunc(args) );
Optionally, make a prototype of it so that it is more flexible. So you do not need to define a file every time you call a function or want to get code from multiple files.
Thielicious Nov 02 '16 at 14:46 2016-11-02 14:46
source share