MCPcopy Create free account
hub / github.com/NativeScript/android / V8GetPrivateValue

Method V8GetPrivateValue

test-app/runtime/src/main/cpp/V8GlobalHelpers.cpp:108–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool tns::V8GetPrivateValue(Isolate* isolate, const Local<Object>& obj, const Local<String>& propName, Local<Value>& out) {
109 auto privateKey = Private::ForApi(isolate, propName);
110
111 auto context = obj->CreationContext();
112 auto hasPrivate = obj->HasPrivate(context, privateKey);
113
114 if (hasPrivate.IsNothing()) {
115 stringstream ss;
116 ss << "Failed to Get Private Value for prop: " << ArgConverter::ConvertToString(propName).c_str() << endl;
117 throw tns::NativeScriptException(ss.str());
118 }
119
120 if (!hasPrivate.FromMaybe(false)) {
121 return false;
122 }
123
124 auto res = obj->GetPrivate(context, privateKey);
125
126 if (res.IsEmpty()) {
127 stringstream ss;
128 ss << "Failed to Get Private Value for prop: " << ArgConverter::ConvertToString(propName).c_str() << endl;
129 throw tns::NativeScriptException(ss.str());
130 }
131
132 return res.ToLocal(&out);
133}
134
135bool tns::V8SetPrivateValue(Isolate* isolate, const Local<Object>& obj, const Local<String>& propName, const Local<Value>& value) {
136 auto privateKey = Private::ForApi(isolate, propName);

Callers

nothing calls this directly

Calls 5

ToLocalMethod · 0.80
IsNothingMethod · 0.45
FromMaybeMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected