11cb0ef41Sopenharmony_ci#include "node.h"
21cb0ef41Sopenharmony_ci#include "v8.h"
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci#include <assert.h>
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciusing v8::Function;
71cb0ef41Sopenharmony_ciusing v8::FunctionCallbackInfo;
81cb0ef41Sopenharmony_ciusing v8::Isolate;
91cb0ef41Sopenharmony_ciusing v8::Local;
101cb0ef41Sopenharmony_ciusing v8::Object;
111cb0ef41Sopenharmony_ciusing v8::Value;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_cinamespace {
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_civoid MakeCallback(const FunctionCallbackInfo<Value>& args) {
161cb0ef41Sopenharmony_ci  assert(args[0]->IsObject());
171cb0ef41Sopenharmony_ci  assert(args[1]->IsFunction());
181cb0ef41Sopenharmony_ci  Isolate* isolate = args.GetIsolate();
191cb0ef41Sopenharmony_ci  Local<Object> recv = args[0].As<Object>();
201cb0ef41Sopenharmony_ci  Local<Function> method = args[1].As<Function>();
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  node::MakeCallback(isolate, recv, method, 0, nullptr,
231cb0ef41Sopenharmony_ci                     node::async_context{0, 0});
241cb0ef41Sopenharmony_ci}
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_civoid Initialize(Local<Object> exports) {
271cb0ef41Sopenharmony_ci  NODE_SET_METHOD(exports, "makeCallback", MakeCallback);
281cb0ef41Sopenharmony_ci}
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci}  // namespace
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciNODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
33