| 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; |