diff --git a/React/Executors/RCTJSCExecutor.h b/React/Executors/RCTJSCExecutor.h index f5b91bf8f..db690042e 100644 --- a/React/Executors/RCTJSCExecutor.h +++ b/React/Executors/RCTJSCExecutor.h @@ -31,18 +31,17 @@ RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification; @interface RCTJSCExecutor : NSObject /** - * 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. diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index 91e80d7b8..a65cd36c4 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -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); }];