-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java setTimeout #406
Comments
+1 |
Same issue, any idea? |
use v8Function.twin() |
how? @Unicellular-SU you can explain? or send an example? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
v8.registerJavaMethod(new JavaVoidCallback() {
@OverRide
public void invoke(final V8Object receiver, final V8Array parameters) {
if (parameters.length() == 2){
final Object timeout = parameters.get(1);
final Object callback = parameters.get(0);
if (!(timeout instanceof Integer) || !(callback instanceof V8Function)){
return;
}
// ((V8Function)callback).call(receiver, null);
new Handler().postDelayed(new Runnable() {
@OverRide
public void run() {
((V8Function)callback).call(receiver,null);
}
},(int)timeout);
}
}
},"setTimeout");
if i call the v8Function immediately, it did work. But if i call the function after some time, the V8Function will be released automatically. Can I hold the v8Function and release it later myself?
The text was updated successfully, but these errors were encountered: