How can I run asynchronously background task in V8?
Closed this issue · 4 comments
wHoIsDReAmer commented
Does not it support?
like this
async function foo() {
while (true) {
// TODO SOME
Thread.sleep(1000);
}
}
foo();
// and can call another synchronous function
function test() {
}
// Java
// ... after call foo function
test.call(null, null);
// but above code is not work
I know that javenode comes out already, but is there no way?
wHoIsDReAmer commented
Then can't implement not only hand-made timer features but some background tasks? like expensive calculate (fibonacci) etc..
caoccao commented
The pattern is the same. The async capability is powered by Promise
. That project demonstrates how to implement Promise
.
wHoIsDReAmer commented
I will check that source! thank you for reply!