Closed sonygod closed 2 months ago
oh,sorry ,here is work.
using tink.CoreApi;
class Main {
public static function main() {
trace('Hello World');
var main = new MainAsync();
main.testAwait().handle(function(v) {
trace('All async operations completed. $v');
});
}
}
@await
class MainAsync {
public function new() {}
@async
public function testAwait() {
trace('start');
@await waitForIt();
trace('end');
}
function waitForIt() {
var f1 = new Future<Int>(cb -> {
var timer = haxe.Timer.delay(function() {
cb(1);
}, 5000);
return function() {
timer.stop(); //
};
});
return f1;
}
}
I just test this small code ,but not work? what's wrong?
build.hxml