Beispiel #1
0
void Init (v8::Handle<v8::Object> target) {
  NanScope();

  v8::Local<v8::FunctionTemplate> returnString = v8::FunctionTemplate::New(ReturnString);
  NanAssignPersistent(v8::FunctionTemplate, returnString_persistent, returnString);
  target->Set(
      NanSymbol("returnString")
    , returnString->GetFunction()
  );
  v8::Local<v8::FunctionTemplate> returnCString = v8::FunctionTemplate::New(ReturnCString);
  NanAssignPersistent(v8::FunctionTemplate, returnCString_persistent, returnCString);
  target->Set(
      NanSymbol("returnCString")
    , returnCString->GetFunction()
  );
  v8::Local<v8::FunctionTemplate> compareCStringToBuffer = v8::FunctionTemplate::New(CompareCStringToBuffer);
  NanAssignPersistent(v8::FunctionTemplate, compareCStringToBuffer_persistent, compareCStringToBuffer);
  target->Set(
      NanSymbol("compareCStringToBuffer")
    , compareCStringToBuffer->GetFunction()
  );
  v8::Local<v8::FunctionTemplate> compareRawStringToBuffer = v8::FunctionTemplate::New(CompareRawStringToBuffer);
  NanAssignPersistent(v8::FunctionTemplate, compareRawStringToBuffer_persistent, compareRawStringToBuffer);
  target->Set(
      NanSymbol("compareRawStringToBuffer")
    , compareRawStringToBuffer->GetFunction()
  );
}
Beispiel #2
0
void SetterGetter::Init(v8::Handle<v8::Object> target) {
  v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(SetterGetter::New)
;
  NanAssignPersistent(v8::FunctionTemplate, settergetter_constructor, tpl);
  tpl->SetClassName(NanSymbol("SetterGetter"));
  tpl->InstanceTemplate()->SetInternalFieldCount(1);
  NODE_SET_PROTOTYPE_METHOD(tpl, "log", SetterGetter::Log);
  v8::Local<v8::ObjectTemplate> proto = tpl->PrototypeTemplate();
  proto->SetAccessor(NanSymbol("prop1"), SetterGetter::GetProp1);
  proto->SetAccessor(NanSymbol("prop2"), SetterGetter::GetProp2, SetterGetter::SetProp2);

  v8::Local<v8::Function> createnew =
    v8::FunctionTemplate::New(CreateNew)->GetFunction();
  target->Set(NanSymbol("create"), createnew);
}
Beispiel #3
0
void Init (v8::Handle<v8::Object> target) {
  target->Set(
      NanSymbol("r")
    , v8::FunctionTemplate::New(ReturnValue)->GetFunction()
  );
}
Beispiel #4
0
void Init (v8::Handle<v8::Object> target) {
  target->Set(
      NanSymbol("r")
    , NanNew<v8::FunctionTemplate>(ReturnNull)->GetFunction()
  );
}
Beispiel #5
0
void Init (v8::Handle<v8::Object> exports) {
    exports->Set(NanSymbol("a"), v8::FunctionTemplate::New(Sleep)->GetFunction());
}
Beispiel #6
0
void Init (v8::Handle<v8::Object> target) {
  target->Set(
      NanSymbol("o")
    , NanNew<v8::FunctionTemplate>(OptionValues)->GetFunction()
  );
}