You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
642 B
28 lines
642 B
5 months ago
|
/*
|
||
|
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);
|
||
|
}
|
||
|
}
|