Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions NativeScript/ffi/jni/jsi/metadata/MetadataNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ JsValue MetadataNode::CreateJSWrapper(JsRuntime &rt, ObjectManager *objectManage
return CreateArrayWrapper(rt);
}

JsValue obj = objectManager->GetEmptyObject();
JsObject plain(rt);
JsValue obj(rt, plain);
JsValue ctorFunc = GetConstructorFunction(rt);
auto object = obj.asObjectBorrowed(rt);
object.setProperty(rt, "constructor", ctorFunc);
js_util::setPrototypeOf(rt, obj, js_util::get_prototype(rt, ctorFunc));
SetInstanceMetadata(rt, obj, this);

Expand Down
5 changes: 3 additions & 2 deletions NativeScript/ffi/jni/napi/metadata/MetadataNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ napi_value MetadataNode::CreateJSWrapper(napi_env env, ObjectManager *objectMana
if (m_isArray) {
obj = CreateArrayWrapper(env);
} else {
obj = objectManager->GetEmptyObject();
NAPI_GUARD(napi_create_object(env, &obj)) {
return nullptr;
}
napi_value ctorFunc = GetConstructorFunction(env);
NAPI_GUARD(napi_set_named_property(env, obj, CONSTRUCTOR, ctorFunc)) {}
napi_util::setPrototypeOf(env, obj, napi_util::get_prototype(env, ctorFunc));
SetInstanceMetadata(env, obj, this);
}
Expand Down
Loading