forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinding.cc
More file actions
24 lines (19 loc) · 749 Bytes
/
Copy pathbinding.cc
File metadata and controls
24 lines (19 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <node.h>
#include <v8.h>
namespace {
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) {
// this != new.target since we are being invoked through super().
assert(args.IsConstructCall());
assert(!args.This()->StrictEquals(args.NewTarget()));
}
inline void Initialize(v8::Local<v8::Object> binding) {
auto isolate = v8::Isolate::GetCurrent();
auto context = isolate->GetCurrentContext();
binding->Set(context, v8::String::NewFromUtf8(
isolate, "Class").ToLocalChecked(),
v8::FunctionTemplate::New(isolate, NewClass)
->GetFunction(context)
.ToLocalChecked()).FromJust();
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
} // anonymous namespace