MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / pushProperties

Method pushProperties

src/script/v8/engine.cpp:281–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279 }
280
281 void pushProperties(v8::Local<v8::Object>& object) {
282 auto& isolate = m_engine.get<V8Engine>()->m_isolate;
283 auto context = m_engine.get<V8Engine>()->context();
284
285 for (auto& entry : properties) {
286 auto getterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.getter));
287 auto getter = getterTpl->GetFunction(context).ToLocalChecked();
288
289 auto setterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.setter));
290 auto setter = setterTpl->GetFunction(context).ToLocalChecked();
291
292 v8::PropertyDescriptor descriptor(getter, setter);
293 Check(object->DefineProperty(context,
294 ToLocal(v8::String::NewFromUtf8(isolate, entry.first.c_str())),
295 descriptor));
296 }
297 }
298
299 v8::Local<v8::Object> makeLocal() {
300 auto isolate = m_engine.get<V8Engine>()->m_isolate;

Callers

nothing calls this directly

Calls 3

CheckFunction · 0.85
ToLocalFunction · 0.85
contextMethod · 0.45

Tested by

no test coverage detected