Skip to content

Commit a159a8e

Browse files
Roland Eischerpmed
authored andcommitted
Added third parameter to be able to set the PropertyAttribute e.g. v8::PropertyAttribute::DontEnum
1 parent db0f110 commit a159a8e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

v8pp/class.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,29 +496,29 @@ class class_
496496
template<typename Method>
497497
typename std::enable_if<
498498
std::is_member_function_pointer<Method>::value, class_&>::type
499-
set(char const *name, Method mem_func)
499+
set(char const *name, Method mem_func, v8::PropertyAttribute attr = v8::None)
500500
{
501501
using mem_func_type =
502502
typename detail::function_traits<Method>::template pointer_type<T>;
503503
mem_func_type mf(mem_func);
504504
class_info_.class_function_template()->PrototypeTemplate()->Set(
505-
isolate(), name, v8::FunctionTemplate::New(isolate(),
505+
v8pp::to_v8(isolate(), name), v8::FunctionTemplate::New(isolate(),
506506
&detail::forward_function<Traits, mem_func_type>,
507-
detail::set_external_data(isolate(), std::forward<mem_func_type>(mf))));
507+
detail::set_external_data(isolate(), std::forward<mem_func_type>(mf))), attr);
508508
return *this;
509509
}
510510

511511
/// Set static class function
512512
template<typename Function,
513513
typename Func = typename std::decay<Function>::type>
514514
typename std::enable_if<detail::is_callable<Func>::value, class_&>::type
515-
set(char const *name, Function&& func)
515+
set(char const *name, Function&& func, v8::PropertyAttribute attr = v8::None)
516516
{
517517
v8::Local<v8::Data> wrapped_fun =
518518
wrap_function_template(isolate(), std::forward<Func>(func));
519519
class_info_.class_function_template()
520-
->PrototypeTemplate()->Set(isolate(), name, wrapped_fun);
521-
class_info_.js_function_template()->Set(isolate(), name, wrapped_fun);
520+
->PrototypeTemplate()->Set(v8pp::to_v8(isolate(), name), wrapped_fun, attr);
521+
class_info_.js_function_template()->Set(v8pp::to_v8(isolate(), name), wrapped_fun, attr);
522522
return *this;
523523
}
524524

0 commit comments

Comments
 (0)