| 106 | } |
| 107 | |
| 108 | bool 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 | |
| 135 | bool tns::V8SetPrivateValue(Isolate* isolate, const Local<Object>& obj, const Local<String>& propName, const Local<Value>& value) { |
| 136 | auto privateKey = Private::ForApi(isolate, propName); |
nothing calls this directly
no test coverage detected