28 lines
642 B
JavaScript
28 lines
642 B
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Tobias Koppers @sokra
|
|
*/
|
|
module.exports = function(src) {
|
|
function log(error) {
|
|
(typeof console !== "undefined")
|
|
&& (console.error || console.log)("[Script Loader]", error);
|
|
}
|
|
|
|
// Check for IE =< 8
|
|
function isIE() {
|
|
return typeof attachEvent !== "undefined" && typeof addEventListener === "undefined";
|
|
}
|
|
|
|
try {
|
|
if (typeof execScript !== "undefined" && isIE()) {
|
|
execScript(src);
|
|
} else if (typeof eval !== "undefined") {
|
|
eval.call(null, src);
|
|
} else {
|
|
log("EvalError: No eval function available");
|
|
}
|
|
} catch (error) {
|
|
log(error);
|
|
}
|
|
}
|