11cb0ef41Sopenharmony_ci#include <node.h> 21cb0ef41Sopenharmony_ci#include <v8.h> 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cinamespace { 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciinline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) { 71cb0ef41Sopenharmony_ci // this != new.target since we are being invoked through super(). 81cb0ef41Sopenharmony_ci assert(args.IsConstructCall()); 91cb0ef41Sopenharmony_ci assert(!args.This()->StrictEquals(args.NewTarget())); 101cb0ef41Sopenharmony_ci} 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciinline void Initialize(v8::Local<v8::Object> binding) { 131cb0ef41Sopenharmony_ci auto isolate = binding->GetIsolate(); 141cb0ef41Sopenharmony_ci auto context = isolate->GetCurrentContext(); 151cb0ef41Sopenharmony_ci binding->Set(context, v8::String::NewFromUtf8( 161cb0ef41Sopenharmony_ci isolate, "Class").ToLocalChecked(), 171cb0ef41Sopenharmony_ci v8::FunctionTemplate::New(isolate, NewClass) 181cb0ef41Sopenharmony_ci ->GetFunction(context) 191cb0ef41Sopenharmony_ci .ToLocalChecked()).FromJust(); 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciNODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci} // anonymous namespace 25