Skip to content

Instantly share code, notes, and snippets.

View botsman's full-sized avatar

Pavel Botsman botsman

View GitHub Profile
@MangelMaxime
MangelMaxime / Async.hx
Last active May 13, 2024 09:43
Demonstrate how to use native async/await from JavaScript with haxe.
package async;
#if macro
import haxe.macro.Context;
#end
class Async {
public static macro function async(expr:haxe.macro.Expr) {
expr = Context.storeTypedExpr(Context.typeExpr(expr));
return macro untyped __js__("(async {0})", ${expr})();