This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +99
-0
lines changed Expand file tree Collapse file tree 7 files changed +99
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
Original file line number Diff line number Diff line change
1
+ ** Fetch dependencies:**
2
+ ```
3
+ npm install
4
+ ```
5
+
6
+ ** Run (using port 8080)**
7
+ ```
8
+ npm start
9
+ ```
10
+
11
+ ** Run server on custom port**
12
+ ```
13
+ node node_modules/http-server/bin/http-server -p 8080
14
+ ```
15
+
16
+ '-p' sets the port to use, default port is 8080. If it is taken pick any port that is free.
17
+ After server is started open 'localhost:8080' in a browser.
Original file line number Diff line number Diff line change
1
+ body
2
+ {
3
+ font-family : 'Segoe UI' , sans-serif
4
+ }
5
+
6
+ span {
7
+ font-style : italic
8
+ }
Original file line number Diff line number Diff line change
1
+ import { Greeter } from 'greeter'
2
+
3
+ export function main ( el : HTMLElement ) : void {
4
+ let greeter = new Greeter ( el ) ;
5
+ greeter . start ( ) ;
6
+ }
Original file line number Diff line number Diff line change
1
+ export class Greeter
2
+ {
3
+ element : HTMLElement ;
4
+ span : HTMLElement ;
5
+ timerToken : number ;
6
+
7
+ constructor ( element : HTMLElement )
8
+ {
9
+ this . element = element ;
10
+ this . element . innerText += "The time is: " ;
11
+ this . span = document . createElement ( 'span' ) ;
12
+ this . element . appendChild ( this . span ) ;
13
+ this . span . innerText = new Date ( ) . toUTCString ( ) ;
14
+ }
15
+
16
+ start ( )
17
+ {
18
+ this . timerToken = setInterval ( ( ) => this . span . innerText = new Date ( ) . toUTCString ( ) , 500 ) ;
19
+ }
20
+
21
+ stop ( )
22
+ {
23
+ clearTimeout ( this . timerToken ) ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < title > SystemJS/TypeScript Sample</ title >
4
+ < link rel ="stylesheet " href ="app.css " type ="text/css " />
5
+ < script src ="node_modules/systemjs/dist/system.js "> </ script >
6
+ </ head >
7
+ < body >
8
+ < script >
9
+ System . transpiler = 'typescript' ;
10
+ System . meta [ 'typescript' ] = { format : 'global' , exports : 'ts' } ;
11
+ System . paths = {
12
+ '*' : '*.ts' ,
13
+ 'typescript' : 'node_modules/typescript/bin/typescript.js'
14
+ }
15
+ System . import ( 'app' ) . then ( function ( m ) {
16
+ var element = document . getElementById ( "content" ) ;
17
+ m . main ( element ) ;
18
+ } ) ;
19
+ </ script >
20
+ < h1 > SystemJS/TypeScript Sample</ h1 >
21
+ < div id ="content "> </ div >
22
+ </ body >
23
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " typescript-systemjs" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " SystemJS/TypeScript demo" ,
5
+ "repository" : {
6
+ "type" : " git" ,
7
+ "url" : " https://github.com/Microsoft/TypeScriptSamples.git"
8
+ },
9
+ "dependencies" : {
10
+ "http-server" : " 0.8.0" ,
11
+ "systemjs" : " 0.18.0"
12
+ },
13
+ "devDependencies" : {
14
+ "typescript" : " ^1.5.3"
15
+ },
16
+ "scripts" : {
17
+ "start" : " node node_modules/http-server/bin/http-server -o"
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments