Browse files

Merge pull request #9 from ccapndave/master

Updating js.Boot.__trace
  • Loading branch information...
2 parents 0864aa5 + 7d24f10 commit 6883a7c880192659f81866bfe66a14c85865ea40 @cloudshift committed Jun 1, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 js/Boot.hx
View
18 js/Boot.hx
@@ -33,23 +33,23 @@ class Boot {
private static function __unhtml(s : String) {
return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
}
-
+
private static function __trace(v,i : haxe.PosInfos) {
untyped {
var msg = if( i != null ) i.fileName+":"+i.lineNumber+": " else "";
#if jsfl
msg += __string_rec(v,"");
fl.trace(msg);
#elseif nodejs
- msg += __string_rec(v,"");
- Node.console.log(msg);
- #else
- msg += __unhtml(__string_rec(v,""))+"<br/>";
+ msg += __string_rec(v,"");
+ Node.console.log(msg);
+ #else
+ msg += __string_rec(v,"");
var d = document.getElementById("haxe:trace");
- if( d == null )
- alert("No haxe:trace element defined\n"+msg);
- else
- d.innerHTML += msg;
+ if( d != null )
+ d.innerHTML += __unhtml(msg)+"<br/>";
+ else if( __js__("typeof")(console) != "undefined" && console.log != null )
+ console.log(msg);
#end
}
}

0 comments on commit 6883a7c

Please sign in to comment.