Haxe (AltJS): デバッグコンソールにトレース出力

SnippetConsole.hx

class SnippetConsole {
    public var recentMessage:String;
    public function new() {
        trace("constructor");
    }
    public function log(message:String) {
        trace(message);
        trace(3);
        recentMessage = message;
    }
}

class SnippetConsoleMain {
    static function main() {
        trace("Hello World !");
        var snippet:SnippetConsole = new SnippetConsole();
        snippet.log("hello world");
    }
}

変換コマンド

$ haxe -main SnippetConsoleMain -js ../release/js/snippet-console.js

(変換後) snippet-console.js

(function () { "use strict";
var SnippetConsoleMain = function() { }
SnippetConsoleMain.main = function() {
	console.log("Hello World !");
	var snippet = new SnippetConsole();
	snippet.log("hello world");
}
var SnippetConsole = function() {
	console.log("constructor");
};
SnippetConsole.prototype = {
	log: function(message) {
		console.log(message);
		console.log(3);
		this.recentMessage = message;
	}
}
SnippetConsoleMain.main();
})();

出力:

Hello World !
constructor
Hello world
3