| 127 | |
| 128 | template <typename Callable> |
| 129 | inline PropertyDescriptor PropertyDescriptor::Function( |
| 130 | const char* utf8name, |
| 131 | Callable cb, |
| 132 | napi_property_attributes attributes, |
| 133 | void* /*data*/) { |
| 134 | using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr))); |
| 135 | using CbData = details::CallbackData<Callable, ReturnType>; |
| 136 | // TODO: Delete when the function is destroyed |
| 137 | auto callbackData = new CbData({cb, nullptr}); |
| 138 | |
| 139 | return PropertyDescriptor({utf8name, |
| 140 | nullptr, |
| 141 | CbData::Wrapper, |
| 142 | nullptr, |
| 143 | nullptr, |
| 144 | nullptr, |
| 145 | attributes, |
| 146 | callbackData}); |
| 147 | } |
| 148 | |
| 149 | template <typename Callable> |
| 150 | inline PropertyDescriptor PropertyDescriptor::Function( |
nothing calls this directly
no test coverage detected