Skip to content

duongphuhiep/learn-typescript-module2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Typescript Training

Demonstration of how to use stealjs to load AMD modules written in Typescript and other external library (jquery, riotjs and RiotControl)

$ npm install
$ bower install
$ npm run build         or      npm run watch  
$ npm start             //will open your browser, then you have to navigate to the 'app' folder

test result

##Why not commonjs? I want to use the module loader on a front-end application (not a nodejs application) so the AMD is more suitable than commonjs (see also Why AMD)

##Project structure

  • npm run build will compile app/*.ts into the gen folder (see tsconfig.json)

project structure

  • The compiler is configured to produce AMD module

    "compilerOptions": { "module": "amd", ... }

  • in the index.html, the stealjs load the main.js

##Remark

  • this example load an internal (hand-made) module (Model.js) and some external library (riot, RiotControl, jquery)
  • each module is used in several different modules but they are loaded only once.

See also: Type script module basic example

About

Demonstration of how to use stealjs to load AMD modules written in Typescript and to load other external library: jquery, riotjs and RiotControl

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published