mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
add "jsBundlesDirectory" method to RCTBridgeDelegate
Differential Revision: D6030185 fbshipit-source-id: 58d6f9d0d412c7ad0f83af9ae4df01c4dc1178bc
This commit is contained in:
committed by
Facebook Github Bot
parent
4192790f05
commit
dd400f842b
@@ -121,4 +121,11 @@
|
||||
- (void)loadSourceForBridge:(RCTBridge *)bridge
|
||||
withBlock:(RCTSourceLoadBlock)loadCallback;
|
||||
|
||||
/**
|
||||
* Specifies the path to folder where additional bundles are located
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
- (NSURL *)jsBundlesDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1190,7 +1190,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
[self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad];
|
||||
[self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize];
|
||||
if (self->_reactInstance) {
|
||||
auto registry = std::make_unique<JSIndexedRAMBundleRegistry>(std::move(ramBundle), sourceUrlStr.UTF8String);
|
||||
NSString *jsBundlesDirectory = [self.delegate respondsToSelector:@selector(jsBundlesDirectory)]
|
||||
? [[self.delegate jsBundlesDirectory].path stringByAppendingString:@"/"]
|
||||
: nil;
|
||||
auto registry = jsBundlesDirectory != nil
|
||||
? std::make_unique<JSIndexedRAMBundleRegistry>(std::move(ramBundle), jsBundlesDirectory.UTF8String)
|
||||
: std::make_unique<RAMBundleRegistry>(std::move(ramBundle));
|
||||
self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr),
|
||||
sourceUrlStr.UTF8String, !async);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user