diff --git a/v8pp/module.hpp b/v8pp/module.hpp index e8344b16..80eb7094 100644 --- a/v8pp/module.hpp +++ b/v8pp/module.hpp @@ -81,10 +81,17 @@ class module static_assert(!detail::is_callable::value, "Variable must not be callable"); v8::HandleScope scope(isolate_); +#if V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && V8_MINOR_VERSION >= 1) + obj_->SetAccessor(v8pp::to_v8(isolate_, name), + &var_get, &var_set, + detail::external_data::set(isolate_, &var), + v8::PropertyAttribute(v8::DontDelete)); +#else obj_->SetAccessor(v8pp::to_v8(isolate_, name), &var_get, &var_set, detail::external_data::set(isolate_, &var), v8::DEFAULT, v8::PropertyAttribute(v8::DontDelete)); +#endif return *this; } @@ -107,7 +114,11 @@ class module v8::AccessorSetterCallback setter = property_type::is_readonly ? nullptr : property_type::template set; v8::Local v8_name = v8pp::to_v8(isolate_, name); v8::Local data = detail::external_data::set(isolate_, property_type(std::move(get), std::move(set))); +#if V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && V8_MINOR_VERSION >= 1) + obj_->SetAccessor(v8_name, getter, setter, data, v8::PropertyAttribute(v8::DontDelete)); +#else obj_->SetAccessor(v8_name, getter, setter, data, v8::DEFAULT, v8::PropertyAttribute(v8::DontDelete)); +#endif return *this; }