This commit is contained in:
ekibun
2021-01-02 00:57:52 +08:00
parent d44af3d093
commit 045277dbe3
13 changed files with 278 additions and 185 deletions

View File

@@ -154,16 +154,18 @@ extern "C"
return new JSValue(JS_NewObject(ctx));
}
DLLEXPORT void jsFreeValue(JSContext *ctx, JSValue *v)
DLLEXPORT void jsFreeValue(JSContext *ctx, JSValue *v, int32_t free)
{
JS_FreeValue(ctx, *v);
delete v;
if (free)
delete v;
}
DLLEXPORT void jsFreeValueRT(JSRuntime *rt, JSValue *v)
DLLEXPORT void jsFreeValueRT(JSRuntime *rt, JSValue *v, int32_t free)
{
JS_FreeValueRT(rt, *v);
delete v;
if (free)
delete v;
}
DLLEXPORT JSValue *jsDupValue(JSContext *ctx, JSValueConst *v)
@@ -215,6 +217,11 @@ extern "C"
return JS_IsFunction(ctx, *val);
}
DLLEXPORT int32_t jsIsPromise(JSContext *ctx, JSValueConst *val)
{
return JS_IsPromise(ctx, *val);
}
DLLEXPORT int32_t jsIsArray(JSContext *ctx, JSValueConst *val)
{
return JS_IsArray(ctx, *val);