1
大家好我試着去加載JS每次都需要骨幹和中堅力量關係我只需要「骨幹」,這是我的代碼:裝載骨幹和中堅力量關係與要求JS
main.js:
requirejs.config({
paths: {
'domReady': 'lib/require/domReady',
'text': 'lib/require/text',
'jquery': 'lib/jquery/jquery',
'underscore': 'lib/underscore',
'backbone': 'lib/backbone/loader',
'relational': 'lib/backbone/relational',
'iosync': 'lib/backbone/iosync',
'iobind': 'lib/backbone/iobind'
},
shim: {
'underscore': {
exports: '_'
},
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
'relational': {
deps: ['backbone']
},
'iobind': {
deps: ['backbone']
},
'iosync': {
deps: ['backbone']
}
}
});
require([
'domReady!',
'jquery',
'backbone',
'models/application',
'views/application'
], function() {
// start the app
var applicationModel = new BACON.models.Application();
var applicationView = new BACON.views.Application({
el: $('body'),
model: applicationModel
});
});
和lib /骨幹網/ loader.js:
define([
'lib/backbone/backbone',
'relational',
'iobind',
'iosync'
]);
但運行我的Chrome應用程式,給了我:
Uncaught Error: Load timeout for modules: relational,iobind,iosync
所以看來我有一個依賴循環...有沒有辦法讓這項工作或有另一種方法來實現這一目標?
感謝您的幫助! – Kev 2013-03-07 21:35:24