Change API for using custom JSC
Reviewed By: javache Differential Revision: D3392219 fbshipit-source-id: ae372dfe9ceab7f7c2da69c731515a05eb3b020a
This commit is contained in:
parent
44c9cf3a91
commit
42a5568419
|
@ -31,18 +31,17 @@ RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification;
|
|||
@interface RCTJSCExecutor : NSObject <RCTJavaScriptExecutor>
|
||||
|
||||
/**
|
||||
* Sets a type of JSC library (system or custom) that's used
|
||||
* to initialize RCTJSCWrapper.
|
||||
* Returns whether executor uses custom JSC library.
|
||||
* This value is used to initialize RCTJSCWrapper.
|
||||
* @default is NO.
|
||||
*/
|
||||
+ (void)setUseCustomJSCLibrary:(BOOL)useCustomLibrary;
|
||||
@property (nonatomic, readonly, assign) BOOL useCustomJSCLibrary;
|
||||
|
||||
/**
|
||||
* Gets a type of JSC library (system or custom) that's used
|
||||
* Inits a new executor instance with given flag that's used
|
||||
* to initialize RCTJSCWrapper.
|
||||
* @default is NO.
|
||||
*/
|
||||
+ (BOOL)useCustomJSCLibrary;
|
||||
- (instancetype)initWithUseCustomJSCLibrary:(BOOL)useCustomJSCLibrary;
|
||||
|
||||
/**
|
||||
* Create a NSError from a JSError object.
|
||||
|
|
|
@ -135,6 +135,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|||
RandomAccessBundleData _randomAccessBundle;
|
||||
|
||||
RCTJSCWrapper *_jscWrapper;
|
||||
BOOL _useCustomJSCLibrary;
|
||||
}
|
||||
|
||||
@synthesize valid = _valid;
|
||||
|
@ -262,21 +263,15 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL useCustomJSCLibrary = NO;
|
||||
|
||||
+ (void)setUseCustomJSCLibrary:(BOOL)useCustomLibrary
|
||||
{
|
||||
useCustomJSCLibrary = useCustomLibrary;
|
||||
}
|
||||
|
||||
+ (BOOL)useCustomJSCLibrary
|
||||
{
|
||||
return useCustomJSCLibrary;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithUseCustomJSCLibrary:NO];
|
||||
}
|
||||
|
||||
- (instancetype)initWithUseCustomJSCLibrary:(BOOL)useCustomJSCLibrary
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_useCustomJSCLibrary = useCustomJSCLibrary;
|
||||
_valid = YES;
|
||||
|
||||
_javaScriptThread = [[NSThread alloc] initWithTarget:[self class]
|
||||
|
@ -333,7 +328,7 @@ static BOOL useCustomJSCLibrary = NO;
|
|||
return;
|
||||
}
|
||||
|
||||
strongSelf->_jscWrapper = RCTJSCWrapperCreate(useCustomJSCLibrary);
|
||||
strongSelf->_jscWrapper = RCTJSCWrapperCreate(strongSelf->_useCustomJSCLibrary);
|
||||
}];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue