-
-
Save jpalala/f53947eb95000da8af146a8c8ebe2e29 to your computer and use it in GitHub Desktop.
TypeScript and JQuery sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = (function () { | |
function Person(name) { | |
this.name = name; | |
} | |
return Person; | |
})(); | |
function greeter(person) { | |
return "hallo " + person.name; | |
} | |
var person = new Person("bert"); | |
$(document).ready(function () { | |
var message = greeter(person); | |
$("#status")[0].innerHTML = message; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.8.0.js"></script> | |
</head> | |
<body> | |
<script src="hello.js"></script> | |
<div id="status"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="jquery.d.ts" /> | |
class Person { | |
constructor(name:string) | |
{ | |
this.name=name; | |
} | |
name: string; | |
} | |
function greeter (person:Person){ | |
return "hallo "+person.name; | |
} | |
var person=new Person("bert"); | |
$(document).ready(function(){ | |
var message = greeter(person); | |
$("#status")[0].innerHTML=message; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment