Skip to content

Instantly share code, notes, and snippets.

@jgranick
Created August 9, 2012 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgranick/3306935 to your computer and use it in GitHub Desktop.
Save jgranick/3306935 to your computer and use it in GitHub Desktop.
"Hello World" in Haxe/Javascript
class TestJS {
static function main () {
trace ("Hello World");
}
}
-main TestJS
-js TestJS.js
--dead-code-elimination
var TestJS = function() { }
TestJS.main = function() {
console.log("Hello World");
}
TestJS.main();
@jgranick
Copy link
Author

jgranick commented Aug 9, 2012

"TestJS.js" is a file that is generated from the Haxe compiler.

@jgranick
Copy link
Author

jgranick commented Aug 9, 2012

If you use the --js-modern flag while compiling, the output will be encapsulated within a function() call. Otherwise it looks like the above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment