In the "Try Haxe" (http://try.haxe.org) site, the default sample test code is as follows:
class Test {
static function main(){
#if js
new js.JQuery("body").html("Haxe is great :)");
#elseif flash
trace("Haxe is great :)");
#end
}
}
Running it on that page is quite straight-forward (can choose "Options" and target either "JS" or "SWF") and the output is the following for "SWF":
Test.hx:6: Haxe is great :)
and the output is the following for "JS":
Haxe is great :)
The part that confuses me is the javascript part because when I compile the source code myself on my laptop, the resulting test.js
file is very complex and looks nothing like the "JS Source" that is displayed on that page:
(function () { "use strict";
var Test = function() { };
Test.main = function() {
new js.JQuery("body").html("Haxe is great :)");
};
var js = {};
var q = window.jQuery;
js.JQuery = q;
Test.main();
})();
Should I change the contents of the Haxe-compiled test.js
to the above? Also, I don't know how the actual index.html
page should look like in order to display the results of the JavaScript output "Haxe is great :)". Any tips on what the actual code for the index.html
page for the JavaScript example output would be appreciated.