我想加載跨域dojo組件,儘管GET請求將JavaScript文件加載到瀏覽器中的狀態爲200,但ready()函數從未觸發要求聲明。還要注意,在這個例子中,Comp1組件是用傳統的dojo.provide(),dojo.require()等語法編寫的,所以我將async設置設置爲legacyAsyc。Dojo跨域代碼不觸發就緒()函數
任何關於事情的建議,我可以嘗試獲取有關正在發生的事情的更多信息將會很棒。在js文件本身的GET請求上沒有CORS標頭,但我不認爲這是執行代碼所需的(??),因爲我在Firebug中沒有收到任何CORS錯誤。
代碼/配置如下。
謝謝。
dojoConfig = {
async: "legacyAsync",
baseUrl: "https://my.remote.domain/path/to/dojo/",
has: {
"dojo-debug-messages": true
},
tlmSiblingOfDojo: true,
packages: [{
name: "myremotestuff",
location: "../../myremotestuff"
}],
trace:{
"loader-inject":1,
"loader-define":1,
"loader-exec-module":1,
"loader-run-factory":1,
"loader-finish-exec":1,
"loader-define-module":1,
"loader-circular-dependency":1
},
isDebug: true,
cacheBust: true
};
...
<script type="text/javascript">
console.info("=== SCRIPT BLOCK BEGIN ===");
require.on('error', function (error) {
console.info("%%%% require error function fired. error: [ " + error + " ] %%%%");
});
require([
"dojo/ready",
"myremotestuff/Comp1"
], function (ready,comp1) {
ready(function(){
console.info("ready() - *Begin* - (I never see these messages, and this line doesn't get hit in debug mode either)");
console.info("ready() - comp1 defined? " + ((comp1 !== undefined) && (comp1 !== null)));
console.info("ready() - *End*");
});
});
console.info("=== SCRIPT BLOCK END ===");
</script>
是否ready.js和的dojo.js文件當中載有200的地位很容易? – barbsan