| 120 | } |
| 121 | |
| 122 | Value MakeAsyncCallbackWithArgv(const Napi::CallbackInfo& info) { |
| 123 | Napi::FunctionReference ref; |
| 124 | ref.Reset(info[0].As<Function>()); |
| 125 | |
| 126 | size_t argLength = info.Length() > 1 ? info.Length() - 1 : 0; |
| 127 | std::unique_ptr<napi_value[]> args{argLength > 0 ? new napi_value[argLength] |
| 128 | : nullptr}; |
| 129 | for (size_t i = 0; i < argLength; ++i) { |
| 130 | args[i] = info[i + 1]; |
| 131 | } |
| 132 | |
| 133 | Napi::AsyncContext context(info.Env(), "func_ref_resources", {}); |
| 134 | return MaybeUnwrap(ref.MakeCallback(Napi::Object::New(info.Env()), |
| 135 | argLength, |
| 136 | argLength > 0 ? args.get() : nullptr, |
| 137 | context)); |
| 138 | } |
| 139 | |
| 140 | Value CreateFunctionReferenceUsingNew(const Napi::CallbackInfo& info) { |
| 141 | Napi::Function func = ObjectWrap<FuncRefObject>::DefineClass( |
nothing calls this directly
no test coverage detected