Promise support for C++ bridge
Summary: Looks like `CxxModule::Method` already supports 0..2 callbacks. Based on Obj-C implementation (RCTModuleMethod.m:492) and JS bridge code (NativeModules.js:76), 2 callbacks native method is transformed to JS promise by JS part of the bridge. Reviewed By: javache Differential Revision: D5207852 fbshipit-source-id: 5aad86d45b97397f2bc3a4dbc648a60d96a4689e
This commit is contained in:
parent
cbb8d6f628
commit
d062cc252e
|
@ -57,7 +57,8 @@ std::vector<MethodDescriptor> CxxNativeModule::getMethods() {
|
|||
std::vector<MethodDescriptor> descs;
|
||||
for (auto& method : methods_) {
|
||||
assert(method.func || method.syncFunc);
|
||||
descs.emplace_back(method.name, method.func ? "async" : "sync");
|
||||
auto methodType = method.func ? (method.callbacks == 2 ? "promise" : "async") : "sync";
|
||||
descs.emplace_back(method.name, methodType);
|
||||
}
|
||||
return descs;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue