[ReactNative] Add RCTBridgeDelegate

Summary:
Add a new bridge delegate protocol to allow a more flexible bridge configuration.

For now it just support the pre-existent configurations + providing the JavaScript
source to the bridge, that should allow pre-loading sources.
This commit is contained in:
Tadeu Zagallo
2015-07-28 15:48:46 -07:00
parent 068f396c9b
commit 127f7095dc
9 changed files with 167 additions and 72 deletions

View File

@@ -15,23 +15,10 @@
#import "RCTUtils.h"
@implementation RCTJavaScriptLoader
{
__weak RCTBridge *_bridge;
}
- (instancetype)initWithBridge:(RCTBridge *)bridge
{
RCTAssert(bridge, @"bridge parameter is required");
if ((self = [super init])) {
_bridge = bridge;
}
return self;
}
RCT_NOT_IMPLEMENTED(-init)
- (void)loadBundleAtURL:(NSURL *)scriptURL onComplete:(void (^)(NSError *, NSString *))onComplete
+ (void)loadBundleAtURL:(NSURL *)scriptURL onComplete:(RCTSourceLoadBlock)onComplete
{
// Sanitize the script URL
scriptURL = [RCTConvert NSURL:scriptURL.absoluteString];