Skip to content

Instantly share code, notes, and snippets.

@skial
Last active February 25, 2021 06:41
Show Gist options
  • Save skial/a1fc270e84babb0af500 to your computer and use it in GitHub Desktop.
Save skial/a1fc270e84babb0af500 to your computer and use it in GitHub Desktop.
Haxe 3.2.0 @:selfCall example used in http://haxe.io/releases/3.2.0/
-js Main.js
-main Main
package;
extern class A {
@:selfCall public function new(v:String);
@:selfCall public function run():Void;
}
extern class B {
public function new(v:String);
public function run():Void;
}
class Main {
static function main() {
var a = new A( '<a href="http://haxememes.tumblr.com/post/46032739244">Haxe Memes</a>' );
var b = new B( '<a href="http://haxememes.tumblr.com/post/46032739244">Haxe Memes</a>' );
a.run();
b.run();
}
}
(function (console) { "use strict";
var Main = function() { };
Main.main = function() {
var a = A("<a href=\"http://haxememes.tumblr.com/post/46032739244\">Haxe Memes</a>");
var b = new B("<a href=\"http://haxememes.tumblr.com/post/46032739244\">Haxe Memes</a>");
a();
b.run();
};
Main.main();
})(typeof console != "undefined" ? console : {log:function(){}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment