Share bundled source URL to RN
Differential Revision: D6192988 fbshipit-source-id: efa584ee2340a34156956990d6cd96d37ba4ab60
This commit is contained in:
parent
9ec9567390
commit
b983de9c54
|
@ -171,6 +171,11 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
|||
*/
|
||||
@property (nonatomic, strong, readonly) NSURL *bundleURL;
|
||||
|
||||
/**
|
||||
* URL of the original script (not necessarily loaded) of the bridge.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly) NSURL *bundledSourceURL;
|
||||
|
||||
/**
|
||||
* The class of the executor currently being used. Changes to this value will
|
||||
* take effect after the bridge is reloaded.
|
||||
|
|
|
@ -329,6 +329,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
// Sanitize the bundle URL
|
||||
_bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString];
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(bundledSourceURLForBridge:)]) {
|
||||
_bundledSourceURL = [self.delegate bundledSourceURLForBridge:self];
|
||||
_bundledSourceURL = [RCTConvert NSURL:_bundledSourceURL.absoluteString];
|
||||
}
|
||||
|
||||
self.batchedBridge = [[bridgeClass alloc] initWithParentBridge:self];
|
||||
[self.batchedBridge start];
|
||||
|
||||
|
|
|
@ -175,10 +175,11 @@ struct RCTInstanceCallback : public InstanceCallback {
|
|||
std::shared_ptr<Instance> _reactInstance;
|
||||
}
|
||||
|
||||
@synthesize loading = _loading;
|
||||
@synthesize valid = _valid;
|
||||
@synthesize performanceLogger = _performanceLogger;
|
||||
@synthesize bridgeDescription = _bridgeDescription;
|
||||
@synthesize loading = _loading;
|
||||
@synthesize bundledSourceURL = _bundledSourceURL;
|
||||
@synthesize performanceLogger = _performanceLogger;
|
||||
@synthesize valid = _valid;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
|
@ -207,6 +208,9 @@ struct RCTInstanceCallback : public InstanceCallback {
|
|||
launchOptions:bridge.launchOptions])) {
|
||||
_parentBridge = bridge;
|
||||
_performanceLogger = [bridge performanceLogger];
|
||||
if ([bridge.delegate respondsToSelector:@selector(bundledSourceURLForBridge:)]) {
|
||||
_bundledSourceURL = [bridge.delegate bundledSourceURLForBridge:bridge];
|
||||
}
|
||||
|
||||
registerPerformanceLoggerHooks(_performanceLogger);
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ RCT_EXPORT_MODULE()
|
|||
- (NSDictionary<NSString *, id> *)constantsToExport
|
||||
{
|
||||
return @{
|
||||
@"scriptURL": self.bridge.bundleURL.absoluteString ?: @""
|
||||
@"scriptURL": self.bridge.bundleURL.absoluteString ?: @"",
|
||||
@"bundledScriptURL": self.bridge.bundledSourceURL.absoluteString ?: @""
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue