0
모든 내 deps가 발견되어로드되었지만 mapApp.js 파일 인 내 응용 프로그램은 발견되지 않으며 사용하려고 할 때 항상 내게 Undefined를 제공합니다.JS가 내 응용 프로그램을 찾을 수 없음을 요구합니다.
내가 뭘 잘못하고 있니?
이 계층 적 내 폴더
Site
|
|- JS
|- Libs
| |- * All my deps *
|
|- mapApp.JS
|
.
.
.
|- /models
|- /views
|- /collections
이 require.js
를 초기화 내 Main.js 파일입니다require.config({
baseUrl: '/ctt-ct/js/'
,urlArgs: "ts=" + (new Date()).getTime()
,paths: {
'jquery': 'libs/jquery.min'
,'underscore': 'libs/underscore-min'
,'backbone': 'libs/backbone'
,'templates': '../templates'
}
,shim: {
jquery: {
exports: '$'
}
,underscore: {
exports: '_'
}
,backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
}
}
});
require([
'jquery'
,'underscore'
,'backbone'
,'mapApp'
],
function ($, _, Backbone, App) {
$; // <- working
_; // <- working
Backbone.View; // <- working
var app = new App(); // <- NOT working !!!
});
mapApp.js
require([
'jquery'
,'underscore'
,'backbone'
],
function ($, _, Backbone) {
var App = Backbone.View.extend({
el : $('#map_canvas')
,initialize : function(){
// DO a lot of stuff and don't return anything.
}
,drawData: function(){
// Do other stuff.
}
});
});
당신은 그것을 찍었습니다! 내 백본 객체를 모든 클래스에 저장하는 var을 반환해야합니까? 같은 모델과 컬렉션도? 나는 그다지 좋아하지 않는다. ( –
필요하다. IntelliJ를 위해 150 $ 라이센스를 구입했을 때, IDE에 꽤 많은 고통이있다. 나는 당신이 더 혼란스러워 할 필요가 없다고 생각한다. 이 모든 변수. –