Skip to content

Instantly share code, notes, and snippets.

@skial
Created January 19, 2012 11:33
Show Gist options
  • Select an option

  • Save skial/1639516 to your computer and use it in GitHub Desktop.

Select an option

Save skial/1639516 to your computer and use it in GitHub Desktop.
normal haxe/javascript class.__init__ output compared to custom haxe/javascript class.__init__ output
// normal haxe/javascript output for class.__init__ methods
{
js.Lib.document = document;
js.Lib.window = window;
onerror = function(msg,url,line) {
var f = js.Lib.onerror;
if( f == null )
return false;
return f(msg,[url+":"+line]);
}
}
{
var hello = "sk";
var i = 1;
}
// odd custom haxe/javascript output for class.__init__ methods
(function($this) {
var $r;
js.Lib.document = document;
js.Lib.window = window;
$r = onerror = function(msg,url,line) {
var f = js.Lib.onerror;
if( f == null )
return false;
return f(msg,[url+":"+line]);
}
return $r;
}(this));
(function($this) {
var $r;
var hello = "sk";
$r = (function($this) {
var $r;
var i = 1;
return $r;
}($this));
return $r;
}(this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment