feat:fix in Android promise invoked immediately
This commit is contained in:
parent
9b9d8de262
commit
359e974424
@ -145,22 +145,24 @@ public class ShaderPlugin extends DoricJavaPlugin {
|
|||||||
};
|
};
|
||||||
AsyncResult<JavaValue> asyncResult = getDoricContext().getDriver()
|
AsyncResult<JavaValue> asyncResult = getDoricContext().getDriver()
|
||||||
.asyncCall(callable, ThreadMode.UI);
|
.asyncCall(callable, ThreadMode.UI);
|
||||||
asyncResult.setCallback(new AsyncResult.Callback<JavaValue>() {
|
if (!method.getReturnType().equals(Void.TYPE)) {
|
||||||
@Override
|
asyncResult.setCallback(new AsyncResult.Callback<JavaValue>() {
|
||||||
public void onResult(JavaValue result) {
|
@Override
|
||||||
doricPromise.resolve(result);
|
public void onResult(JavaValue result) {
|
||||||
}
|
doricPromise.resolve(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable t) {
|
public void onError(Throwable t) {
|
||||||
doricPromise.resolve(new JavaValue(t.getLocalizedMessage()));
|
doricPromise.resolve(new JavaValue(t.getLocalizedMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ArchiveException e) {
|
} catch (ArchiveException e) {
|
||||||
|
Reference in New Issue
Block a user