mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
enqueueJSCall instead of global dynamic require
Summary: BridgeProfiling.setEnabled used a one off eval. Let's use the bridge to do this like everything else. This is already what the Android equivalent is doing. public Reviewed By: tadeuzagallo Differential Revision: D2745059 fb-gh-sync-id: 5b633365b8cfc8abc6b80255e82ef3053ead9b50
This commit is contained in:
parent
836ba8fb38
commit
2696f9440e
@ -417,11 +417,7 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
|
||||
{
|
||||
[self executeBlockOnJavaScriptQueue:^{
|
||||
BOOL enabled = [notification.name isEqualToString:RCTProfileDidStartProfiling];
|
||||
// TODO: Don't use require, go through the normal execution modes instead. #9317773
|
||||
NSString *script = [NSString stringWithFormat:@"var p = require('Systrace') || {}; p.setEnabled && p.setEnabled(%@)", enabled ? @"true" : @"false"];
|
||||
JSStringRef scriptJSRef = JSStringCreateWithUTF8CString(script.UTF8String);
|
||||
JSEvaluateScript(_context.ctx, scriptJSRef, NULL, NULL, 0, NULL);
|
||||
JSStringRelease(scriptJSRef);
|
||||
[_bridge enqueueJSCall:@"Systrace.setEnabled" args:@[enabled ? @YES : @NO]];
|
||||
}];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user