mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-25 06:00:26 +08:00
Remove callFunctionSync experimental APIs
Reviewed By: michalgr Differential Revision: D6124038 fbshipit-source-id: 219afe30783da92cf10f800dc35e64823b61cf4b
This commit is contained in:
committed by
Facebook Github Bot
parent
860fcd458a
commit
19a4a7d3cb
@@ -55,35 +55,6 @@ public:
|
||||
*/
|
||||
void invokeCallback(double callbackId, folly::dynamic&& args);
|
||||
|
||||
/**
|
||||
* Executes a JS method on the given executor synchronously, returning its
|
||||
* return value. JSException will be thrown if JS throws an exception;
|
||||
* another standard exception may be thrown for C++ bridge failures, or if
|
||||
* the executor is not capable of synchronous calls.
|
||||
*
|
||||
* This method is experimental, and may be modified or removed.
|
||||
*
|
||||
* loadApplicationScriptSync() must be called and finished executing
|
||||
* before callFunctionSync().
|
||||
*/
|
||||
template <typename T>
|
||||
Value callFunctionSync(const std::string& module, const std::string& method, T&& args) {
|
||||
if (*m_destroyed) {
|
||||
throw std::logic_error(
|
||||
folly::to<std::string>("Synchronous call to ", module, ".", method,
|
||||
" after bridge is destroyed"));
|
||||
}
|
||||
|
||||
JSCExecutor *jscExecutor = dynamic_cast<JSCExecutor*>(m_executor.get());
|
||||
if (!jscExecutor) {
|
||||
throw std::invalid_argument(
|
||||
folly::to<std::string>("Executor type ", typeid(m_executor.get()).name(),
|
||||
" does not support synchronous calls"));
|
||||
}
|
||||
|
||||
return jscExecutor->callFunctionSync(module, method, std::forward<T>(args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the JS application. If bundleRegistry is non-null, then it is
|
||||
* used to fetch JavaScript modules as individual scripts.
|
||||
|
||||
Reference in New Issue
Block a user