0
이 포함되어 있습니다. js 파일을 포함 /로드 할 때 오류를 잡는 처리기가 있습니까?파일에 JS 오류 잡기에는
나는 배열을 반복하며 스크립트를 머리에 추가하고 있습니다. 포함 된 JS 파일에 오류가있는 경우 볼 수있는 방법이 있습니다 (ergo 다음에 포함 된 시퀀스 두통을 제거 할 수 있습니다. 단지 js 파일로드를 5 번 또는 5 번 또는 심지어 파일을 잡는 js 파일의 배열을 통해 반복합니다. 어쩌면
var incFile=[
"Grid.EditGrid"
,"Data.AutoSaveStore"
,"Form.FormPanel"
,"ux.Spotlight"
];
//http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
//This can be extended to include css files aswell
//Dynamic Js file loading
loadJsFile = function(filename){
var fileref=document.createElement('script');
fileref.setAttribute("src", "js"+filename);
fileref.setAttribute("language","javascript");
document.getElementsByTagName("head")[0].appendChild(fileref);
};
//The loop to include java files
for (var f=0;f<=incFile.length-1;f++){
var path = "";
var split = incFile[f].split(".");
//Build the relative path
for(var s=0;s<=split.length-1;s++){
path += "/"+split[s];
};
loadJsFile(path+".js");
};