mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-19 21:29:36 +08:00
Add some more helper methods to Value
Reviewed By: mhorowitz Differential Revision: D4197278 fbshipit-source-id: 9a538ff2747d32a54d42627a9f78e4a348dce639
This commit is contained in:
committed by
Facebook Github Bot
parent
1604f10889
commit
674d86cdcb
@@ -11,6 +11,8 @@
|
||||
#include <jschelpers/Value.h>
|
||||
#include "JSCLegacyProfiler.h"
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
static JSValueRef nativeProfilerStart(
|
||||
JSContextRef ctx,
|
||||
JSObjectRef function,
|
||||
@@ -20,11 +22,11 @@ static JSValueRef nativeProfilerStart(
|
||||
JSValueRef* exception) {
|
||||
if (argumentCount < 1) {
|
||||
if (exception) {
|
||||
*exception = facebook::react::makeJSCException(
|
||||
*exception = Value::makeError(
|
||||
ctx,
|
||||
"nativeProfilerStart: requires at least 1 argument");
|
||||
}
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception);
|
||||
@@ -34,7 +36,7 @@ static JSValueRef nativeProfilerStart(
|
||||
JSStartProfiling(ctx, title);
|
||||
#endif
|
||||
JSStringRelease(title);
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
static JSValueRef nativeProfilerEnd(
|
||||
@@ -46,11 +48,11 @@ static JSValueRef nativeProfilerEnd(
|
||||
JSValueRef* exception) {
|
||||
if (argumentCount < 1) {
|
||||
if (exception) {
|
||||
*exception = facebook::react::makeJSCException(
|
||||
*exception = Value::makeError(
|
||||
ctx,
|
||||
"nativeProfilerEnd: requires at least 1 argument");
|
||||
}
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
std::string writeLocation("/sdcard/");
|
||||
@@ -64,7 +66,7 @@ static JSValueRef nativeProfilerEnd(
|
||||
JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception);
|
||||
JSEndProfilingAndRender(ctx, title, writeLocation.c_str());
|
||||
JSStringRelease(title);
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
namespace facebook {
|
||||
|
||||
Reference in New Issue
Block a user