| 81 | } |
| 82 | |
| 83 | Value CallWithRecvArgc(const CallbackInfo& info) { |
| 84 | EscapableHandleScope scope(info.Env()); |
| 85 | FunctionReference ref; |
| 86 | ref.Reset(info[0].As<Function>()); |
| 87 | |
| 88 | size_t argLength = info.Length() > 2 ? info.Length() - 2 : 0; |
| 89 | std::unique_ptr<napi_value[]> args{argLength > 0 ? new napi_value[argLength] |
| 90 | : nullptr}; |
| 91 | for (size_t i = 0; i < argLength; ++i) { |
| 92 | args[i] = info[i + 2]; |
| 93 | } |
| 94 | |
| 95 | return scope.Escape(MaybeUnwrap(ref.Call(info[1], argLength, args.get()))); |
| 96 | } |
| 97 | |
| 98 | Value MakeAsyncCallbackWithInitList(const Napi::CallbackInfo& info) { |
| 99 | Napi::FunctionReference ref; |