COMMUNITY

How to use await with mysql request?

how to use await with mysql request?

I found tink_await lib ,but there are few detail about how to use .

package;



import haxe.MainLoop;
import Random;
using tink.CoreApi;



 
@await class Main {
	@await static function main() {
		trace("start");
		@await foo();//it's still block mainThread.what async ?
		trace(2);
	}
	
	@async static function foo() {
		
		
		
		var i = 0;
		while (i < 1000000){
			Random.string(12);
		}
		
		return 0;
		
	}
	
	static function check() {
		$type(main); // Void -> Void
		$type(foo); // Void -> tink.core.Promise<Int>
	}
}

I did a test ,can’t see what’s async …it’s still block mainthread