Without using a package manager (require.js), it depends on the callbacks provided by the library. Otherwise, just check to see if a function exists, if not, try again in a second
// Stop checking after 10 seconds
var scriptTimedOut = window.setTimeout(function() {
window.clearInterval(checkIfLoaded);
alert("Script took more than 10secs, so give up");
}, 10000);
// Check every 1 second if the function exists in the script yet
var checkIfLoaded = window.setInterval(function() {
if (someFunctionInTheScript) {
// The script is loaded so stop checking
window.clearInterval(checkIfLoaded);
window.clearTimeout(scriptTimedOut);
}
}, 1000);