We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6b7e73d + c78a6fa commit 400d6c3Copy full SHA for 400d6c3
native_mate/dictionary.h
@@ -93,6 +93,19 @@ class Dictionary {
93
return !result.IsNothing() && result.FromJust();
94
}
95
96
+ template<typename T>
97
+ bool SetReadOnly(const base::StringPiece& key, T val) {
98
+ v8::Local<v8::Value> v8_value;
99
+ if (!TryConvertToV8(isolate_, val, &v8_value))
100
+ return false;
101
+ v8::Maybe<bool> result =
102
+ GetHandle()->DefineOwnProperty(isolate_->GetCurrentContext(),
103
+ StringToV8(isolate_, key),
104
+ v8_value,
105
+ v8::ReadOnly);
106
+ return !result.IsNothing() && result.FromJust();
107
+ }
108
+
109
template<typename T>
110
bool SetMethod(const base::StringPiece& key, const T& callback) {
111
return GetHandle()->Set(
0 commit comments