[JSContext] Define `ContextExecutor.setContextName` for debugging
Summary: Add a method that lets JS set the name of the JSContext for debugging purposes. I check `JSGlobalContextSetName` since it is not available on iOS 7. Closes https://github.com/facebook/react-native/pull/2144 Github Author: James Ide <ide@jameside.com>
This commit is contained in:
parent
47e1d1aef8
commit
eab7b00cee
|
@ -557,4 +557,13 @@ static NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError)
|
|||
}), @"js_call,json_call", (@{@"objectName": objectName}))];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setContextName:(NSString *)name)
|
||||
{
|
||||
if (JSGlobalContextSetName != NULL) {
|
||||
JSStringRef JSName = JSStringCreateWithCFString((__bridge CFStringRef)name);
|
||||
JSGlobalContextSetName(_context.ctx, JSName);
|
||||
JSStringRelease(JSName);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue