fix syntax
This commit is contained in:
10
layout.c
10
layout.c
@@ -39,9 +39,9 @@ static JSValue js_layout_set_size(JSContext *js, JSValueConst self, int argc, JS
|
||||
double width = 0, height = 0;
|
||||
|
||||
// Check if it's an array (for backwards compatibility)
|
||||
if (JS_IsArray(js, argv[1])) {
|
||||
JSValue width_val = JS_GetPropertyUint32(js, argv[1], 0);
|
||||
JSValue height_val = JS_GetPropertyUint32(js, argv[1], 1);
|
||||
if (JS_IsArray(argv[1])) {
|
||||
JSValue width_val = JS_GetPropertyNumber(js, argv[1], 0);
|
||||
JSValue height_val = JS_GetPropertyNumber(js, argv[1], 1);
|
||||
JS_ToFloat64(js, &width, width_val);
|
||||
JS_ToFloat64(js, &height, height_val);
|
||||
JS_FreeValue(js, width_val);
|
||||
@@ -162,7 +162,7 @@ static JSValue js_layout_reset(JSContext *js, JSValueConst self, int argc, JSVal
|
||||
static void js_layout_finalizer(JSRuntime *rt, JSValue val) {
|
||||
lay_context *ctx = JS_GetOpaque(val, js_layout_class_id);
|
||||
lay_destroy_context(ctx);
|
||||
js_free_rt(rt, ctx);
|
||||
js_free_rt(ctx);
|
||||
}
|
||||
|
||||
static JSClassDef js_layout_class = {
|
||||
@@ -190,7 +190,7 @@ static const JSCFunctionListEntry js_layout_funcs[] = {
|
||||
|
||||
CELL_USE_INIT(
|
||||
JS_NewClassID(&js_layout_class_id);
|
||||
JS_NewClass(JS_GetRuntime(js), js_layout_class_id, &js_layout_class);
|
||||
JS_NewClass(js, js_layout_class_id, &js_layout_class);
|
||||
|
||||
JSValue proto = JS_NewObject(js);
|
||||
JS_SetPropertyFunctionList(js, proto, js_layout_proto_funcs, sizeof(js_layout_proto_funcs) / sizeof(JSCFunctionListEntry));
|
||||
|
||||
Reference in New Issue
Block a user