Closed posxposy closed 6 years ago
did you put @:await
on your class?
Yes, I am. That did not helped.
The problem is that:
@:async
or @:await
so that its content will be transformed. In your case the constructor is not tagger so that the @await
inside it won't do anything.The following code should work.
using tink.CoreApi;
@:await
class Main {
function f() {
var trigger = Future.trigger();
trigger.trigger('hello');
return trigger.asFuture();
}
@:await function new() {
var s = @:await f();
trace(s);
}
static function main() {
new Main();
}
}
Ah, thank you, thats help me a lot! Got it to work now.
Hey ;)
With this code:
I got an error:
tink.core.Future<String> should be String
If I change it to
then it compiles ok, but how to get my result as String and not as Future?
Thanks.