register `nativeRequire` on JS thread

Reviewed By: tadeuzagallo

Differential Revision: D3087194

fb-gh-sync-id: 9c7bb37260dd202d1ee54606007be02de6c0fb55
shipit-source-id: 9c7bb37260dd202d1ee54606007be02de6c0fb55
This commit is contained in:
Martín Bigio 2016-03-23 09:27:20 -07:00 committed by Facebook Github Bot 1
parent 8edc35004c
commit 24508d0d58
1 changed files with 2 additions and 2 deletions

View File

@ -671,7 +671,7 @@ static int readBundle(FILE *fd, size_t offset, size_t length, void *ptr) {
- (void)registerNativeRequire - (void)registerNativeRequire
{ {
__weak RCTJSCExecutor *weakSelf = self; __weak RCTJSCExecutor *weakSelf = self;
_context.context[@"nativeRequire"] = ^(NSString *moduleName) { [self addSynchronousHookWithName:@"nativeRequire" usingBlock:^(NSString *moduleName) {
RCTJSCExecutor *strongSelf = weakSelf; RCTJSCExecutor *strongSelf = weakSelf;
if (!strongSelf || !moduleName) { if (!strongSelf || !moduleName) {
return; return;
@ -696,7 +696,7 @@ static int readBundle(FILE *fd, size_t offset, size_t length, void *ptr) {
[strongSelf invalidate]; [strongSelf invalidate];
}); });
} }
}; }];
} }
- (NSData *)loadRAMBundle:(NSURL *)sourceURL error:(NSError **)error - (NSData *)loadRAMBundle:(NSURL *)sourceURL error:(NSError **)error