1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | // Wrapper around Nan::SetAccessor that makes it easier to change the last
|
7 | // argument (signature). Getters/setters must be accessed only when there is
|
8 | // actually an instance, i.e. MyClass.prototype.getter1 should not try to
|
9 | // unwrap the non-existent 'this'. See #803, #847, #885, nodejs/node#15099, ...
|
10 | inline void SetProtoAccessor(
|
11 | v8::Local<v8::ObjectTemplate> tpl,
|
12 | v8::Local<v8::String> name,
|
13 | Nan::GetterCallback getter,
|
14 | Nan::SetterCallback setter,
|
15 | v8::Local<v8::FunctionTemplate> ctor
|
16 | ) {
|
17 | Nan::SetAccessor(
|
18 | tpl,
|
19 | name,
|
20 | getter,
|
21 | setter,
|
22 | v8::Local<v8::Value>(),
|
23 | v8::DEFAULT,
|
24 | v8::None,
|
25 | v8::AccessorSignature::New(v8::Isolate::GetCurrent(), ctor)
|
26 | );
|
27 | }
|