mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 03:13:52 +08:00
CatalystInstanceImpl.setSourceURL
Reviewed By: javache Differential Revision: D4422416 fbshipit-source-id: bc49485ac64064909f32375b6b8360a0a505975b
This commit is contained in:
committed by
Facebook Github Bot
parent
bbd5750bb4
commit
76c4faee5e
@@ -50,6 +50,14 @@ void Instance::initializeBridge(
|
||||
CHECK(nativeToJsBridge_);
|
||||
}
|
||||
|
||||
void Instance::setSourceURL(std::string sourceURL) {
|
||||
callback_->incrementPendingJSCalls();
|
||||
SystraceSection s("reactbridge_xplat_setSourceURL",
|
||||
"sourceURL", sourceURL);
|
||||
|
||||
nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL));
|
||||
}
|
||||
|
||||
void Instance::loadScriptFromString(std::unique_ptr<const JSBigString> string,
|
||||
std::string sourceURL) {
|
||||
callback_->incrementPendingJSCalls();
|
||||
@@ -74,15 +82,10 @@ void Instance::loadScriptFromFile(const std::string& filename,
|
||||
|
||||
std::unique_ptr<const JSBigFileString> script;
|
||||
|
||||
// This function can be called in order to change the Bridge's Source URL.
|
||||
// In that case, the filename will be empty, and we should not attempt to
|
||||
// load it.
|
||||
if (!filename.empty()) {
|
||||
RecoverableError::runRethrowingAsRecoverable<std::system_error>(
|
||||
[&filename, &script]() {
|
||||
script = JSBigFileString::fromPath(filename);
|
||||
});
|
||||
}
|
||||
RecoverableError::runRethrowingAsRecoverable<std::system_error>(
|
||||
[&filename, &script]() {
|
||||
script = JSBigFileString::fromPath(filename);
|
||||
});
|
||||
|
||||
nativeToJsBridge_->loadApplication(nullptr, std::move(script), sourceURL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user