2012-10-19 4 views
1

TypeScript 및 dojo AMD에서 AMD를 사용하는 모든 예는 무엇입니까? 대신 객체 (tslab의 == 3)의 "3"가 계속 :TypeScript + Dojo + AMD?

require(["TypeScriptLab"], function (tslab) 
    { 
     new tslab.Tests().run(); 
    }); 

타이프 스크립트는 다음과 같다 :

export class TypeScriptLab { 
    test() { 
    } 
} 

생성 JS는 다음과 같다 :

define(["require", "exports"], function(require, exports) { 
    var TypeScriptLab = (function() { 
     function TypeScriptLab() { } 
     TypeScriptLab.prototype.test = function() { 
     }; 
     return TypeScriptLab; 
    })(); 
    exports.TypeScriptLab = TypeScriptLab;  
}) 
+0

언급 한대로 무시한 나는 dojo 1.8.0을 사용하고있다. –

답변

1

패키지를 정의했습니다.

<script> 
    dojoConfig = { 
     async: true, 
     packages: [ 
      { name: "TSLab", location: "/IPS" } 
     ] 
    }; 
</script> 

그리고 네임 스페이스 프리픽스를 추가했습니다 :

require(["TSLab/typeScriptLab"], function (tslab) 
    { 
     new tslab.Tests().run(); 
    }); 

이제 모듈이로드됩니다.