当前位置: 首页>>代码示例>>C++>>正文


C++ Handle::Set方法代码示例

本文整理汇总了C++中v8::Handle::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::Set方法的具体用法?C++ Handle::Set怎么用?C++ Handle::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在v8::Handle的用法示例。


在下文中一共展示了Handle::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Init

void Bush::Init(v8::Handle<v8::Object> target)
{
	// Prepare constructor template
		v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(nodeNew);
		tpl->SetClassName(v8::String::NewSymbol("Bush"));
		tpl->InstanceTemplate()->SetInternalFieldCount(1);

		// Prototype functions
		tpl->PrototypeTemplate()->Set(v8::String::NewSymbol("collide"), v8::FunctionTemplate::New(nodeCollide)->GetFunction());

		v8::Persistent<v8::Function> constructor = v8::Persistent<v8::Function>::New(tpl->GetFunction());
		target->Set(v8::String::NewSymbol("Bush"), constructor);
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例2: Init

void Init (v8::Handle<v8::Object> target) {
  target->Set(
      NanNew<v8::String>("save1")
    , NanNew<v8::FunctionTemplate>(Save1)->GetFunction()
  );
  target->Set(
      NanNew<v8::String>("get1")
    , NanNew<v8::FunctionTemplate>(Get1)->GetFunction()
  );
  target->Set(
      NanNew<v8::String>("dispose1")
    , NanNew<v8::FunctionTemplate>(Dispose1)->GetFunction()
  );
  target->Set(
      NanNew<v8::String>("toPersistentAndBackAgain")
    , NanNew<v8::FunctionTemplate>(ToPersistentAndBackAgain)->GetFunction()
  );
  target->Set(
      NanNew<v8::String>("persistentToPersistent")
    , NanNew<v8::FunctionTemplate>(PersistentToPersistent)->GetFunction()
  );
}
开发者ID:az7arul,项目名称:nan,代码行数:22,代码来源:persistent.cpp

示例3: Init

  static void Init(v8::Handle<v8::Object> exports) {
    NanScope();

    v8::Local<v8::FunctionTemplate> tpl = NanNew<v8::FunctionTemplate>(New);
    NanAssignPersistent(base_type::function_template, tpl);
    tpl->SetClassName(NanNew(ClassName));
    tpl->InstanceTemplate()->SetInternalFieldCount(1);

    EIGENJS_OBJECT_INITIALIZE(PartialPivLU, tpl)

    exports->Set(NanNew(ClassName), tpl->GetFunction());
    NanAssignPersistent(base_type::constructor, tpl->GetFunction());
  }
开发者ID:Regina-Cupido-Officium,项目名称:eigenjs,代码行数:13,代码来源:PartialPivLU.hpp

示例4: AddMethods

/*static*/ void wxNode_wxButton::Init(v8::Handle<v8::Object> target) {
  v8::HandleScope scope;

  v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(wxNodeObject::NewFunc);
  s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
  s_ct->InstanceTemplate()->SetInternalFieldCount(2);
  s_ct->SetClassName(v8::String::NewSymbol("Button"));

  NODE_SET_PROTOTYPE_METHOD(s_ct, "init", _init);
  AddMethods(s_ct);

  target->Set(v8::String::NewSymbol("Button"), s_ct->GetFunction());
}
开发者ID:Benvie,项目名称:wxNode,代码行数:13,代码来源:wxNode_wxButton.cpp

示例5:

void
FixedJpegStack::Initialize(v8::Handle<v8::Object> target)
{
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);
    t->InstanceTemplate()->SetInternalFieldCount(1);
    NODE_SET_PROTOTYPE_METHOD(t, "encode", JpegEncodeAsync);
    NODE_SET_PROTOTYPE_METHOD(t, "encodeSync", JpegEncodeSync);
    NODE_SET_PROTOTYPE_METHOD(t, "push", Push);
    NODE_SET_PROTOTYPE_METHOD(t, "setQuality", SetQuality);
    target->Set(String::NewSymbol("FixedJpegStack"), t->GetFunction());
}
开发者ID:elbart,项目名称:node-jpeg,代码行数:13,代码来源:fixed_jpeg_stack.cpp

示例6: Init

void MyObject::Init(v8::Handle<v8::Object> exports) {
    NanScope();

    // Prepare constructor template
    v8::Local<v8::FunctionTemplate> tpl = NanNew<v8::FunctionTemplate>(New);
    tpl->SetClassName(NanNew<v8::String>("MyObject"));
    tpl->InstanceTemplate()->SetInternalFieldCount(1);

    NODE_SET_PROTOTYPE_METHOD(tpl, "call_emit", CallEmit);

    NanAssignPersistent<v8::Function>(constructor, tpl->GetFunction());
    exports->Set(NanNew<v8::String>("MyObject"), tpl->GetFunction());
}
开发者ID:Claercio,项目名称:tint2,代码行数:13,代码来源:makecallback.cpp

示例7: Init

void NthPrime::Init(v8::Handle<v8::Object> target) {
  // Prepare constructor function template.
  v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(NthPrime::New);
  tpl->SetClassName(v8::String::NewSymbol("NthPrime"));
  tpl->InstanceTemplate()->SetInternalFieldCount(1);
  // Add class methods to constructor function prototype
  tpl->PrototypeTemplate()->Set(v8::String::NewSymbol("getNthPrime"),
        v8::FunctionTemplate::New(NthPrime::getNthPrime_JS)->GetFunction());

  // Add the constructor to the module exports.
  target->Set(v8::String::NewSymbol("NthPrime"),
      v8::Persistent<v8::Function>::New(tpl->GetFunction()));
}
开发者ID:hammonda,项目名称:NodeAddons,代码行数:13,代码来源:NthPrime.cpp

示例8: InitDevice

void InitDevice(v8::Handle<v8::Object> exports)
{
    exports->Set(NanNew("getDeviceCount"), NanNew<FunctionTemplate>(GetDeviceCount)->GetFunction());
    exports->Set(NanNew("getDevice"), NanNew<FunctionTemplate>(GetDevice)->GetFunction());
    exports->Set(NanNew("setDevice"), NanNew<FunctionTemplate>(SetDevice)->GetFunction());
    exports->Set(NanNew("deviceInfo"), NanNew<FunctionTemplate>(DeviceInfo)->GetFunction());
    exports->Set(NanNew("isDoubleAvailable"), NanNew<FunctionTemplate>(IsDoubleAvailable)->GetFunction());
    exports->Set(NanNew("sync"), NanNew<FunctionTemplate>(Sync)->GetFunction());
    exports->Set(NanNew("wait"), NanNew<FunctionTemplate>(Sync)->GetFunction());
    exports->Set(NanNew("alloc"), NanNew<FunctionTemplate>(Alloc)->GetFunction());
    exports->Set(NanNew("pinned"), NanNew<FunctionTemplate>(Pinned)->GetFunction());
}
开发者ID:umar456,项目名称:arrayfire-js,代码行数:12,代码来源:device.cpp

示例9: Init

void ODBC::Init(v8::Handle<Object> target) {
  DEBUG_PRINTF("ODBC::Init\n");
  HandleScope scope;

  Local<FunctionTemplate> t = FunctionTemplate::New(New);

  // Constructor Template
  constructor_template = Persistent<FunctionTemplate>::New(t);
  constructor_template->SetClassName(String::NewSymbol("ODBC"));

  // Reserve space for one Handle<Value>
  Local<ObjectTemplate> instance_template = constructor_template->InstanceTemplate();
  instance_template->SetInternalFieldCount(1);
  
  // Constants
  NODE_DEFINE_CONSTANT(constructor_template, SQL_CLOSE);
  NODE_DEFINE_CONSTANT(constructor_template, SQL_DROP);
  NODE_DEFINE_CONSTANT(constructor_template, SQL_UNBIND);
  NODE_DEFINE_CONSTANT(constructor_template, SQL_RESET_PARAMS);
  NODE_DEFINE_CONSTANT(constructor_template, SQL_DESTROY); //SQL_DESTROY is non-standard
  NODE_DEFINE_CONSTANT(constructor_template, FETCH_ARRAY);
  NODE_DEFINE_CONSTANT(constructor_template, FETCH_OBJECT);
  
  // Prototype Methods
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "createConnection", CreateConnection);
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "createConnectionSync", CreateConnectionSync);

  // Attach the Database Constructor to the target object
  target->Set( v8::String::NewSymbol("ODBC"),
               constructor_template->GetFunction());
  
#if NODE_VERSION_AT_LEAST(0, 7, 9)
  // Initialize uv_async so that we can prevent node from exiting
  uv_async_init( uv_default_loop(),
                 &ODBC::g_async,
                 ODBC::WatcherCallback);
  
  // Not sure if the init automatically calls uv_ref() because there is weird
  // behavior going on. When ODBC::Init is called which initializes the 
  // uv_async_t g_async above, there seems to be a ref which will keep it alive
  // but we only want this available so that we can uv_ref() later on when
  // we have a connection.
  // so to work around this, I am possibly mistakenly calling uv_unref() once
  // so that there are no references on the loop.
  uv_unref((uv_handle_t *)&ODBC::g_async);
#endif
  
  // Initialize the cross platform mutex provided by libuv
  uv_mutex_init(&ODBC::g_odbcMutex);
}
开发者ID:impy88,项目名称:node-odbc,代码行数:50,代码来源:odbc.cpp

示例10: bind_Debug_AudioSource

bool bind_Debug_AudioSource(v8::Handle<v8::Object> parent)
{
    ScriptingManager* pManager = ScriptingManager::getSingletonPtr();

    v8::Handle<FunctionTemplate> component = pManager->getClassTemplate("Athena.Graphics.Debug.AudioSource");

    if (component.IsEmpty())
    {
        assert(!pManager->getClassTemplate("Athena.Graphics.Debug.DebugComponent").IsEmpty());

        // Declaration of the class
        component = FunctionTemplate::New(Debug_AudioSource_New);
        component->InstanceTemplate()->SetInternalFieldCount(1);
        component->Inherit(pManager->getClassTemplate("Athena.Graphics.Debug.DebugComponent"));

        pManager->declareClassTemplate("Athena.Graphics.Debug.AudioSource", component);

        parent->Set(String::New("AudioSource_TYPE"), String::New(Athena::Graphics::Debug::AudioSource::TYPE.c_str()));
    }

    // Add the class to the parent
    return parent->Set(String::New("AudioSource"), component->GetFunction());
}
开发者ID:Kanma,项目名称:Athena-Graphics,代码行数:23,代码来源:AudioSource.cpp

示例11: Init

void ODBC::Init(v8::Handle<Object> exports) {
  DEBUG_PRINTF("ODBC::Init\n");
  Nan::HandleScope scope;

  Local<FunctionTemplate> constructor_template = Nan::New<FunctionTemplate>(New);

  // Constructor Template
  constructor_template->SetClassName(Nan::New("ODBC").ToLocalChecked());

  // Reserve space for one Handle<Value>
  Local<ObjectTemplate> instance_template = constructor_template->InstanceTemplate();
  instance_template->SetInternalFieldCount(1);
  
  PropertyAttribute constant_attributes = static_cast<PropertyAttribute>(ReadOnly | DontDelete);
  constructor_template->Set(Nan::New<String>("SQL_CLOSE").ToLocalChecked(), Nan::New<Number>(SQL_CLOSE), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_DROP").ToLocalChecked(), Nan::New<Number>(SQL_DROP), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_UNBIND").ToLocalChecked(), Nan::New<Number>(SQL_UNBIND), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_RESET_PARAMS").ToLocalChecked(), Nan::New<Number>(SQL_RESET_PARAMS), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_DESTROY").ToLocalChecked(), Nan::New<Number>(SQL_DESTROY), constant_attributes);
  constructor_template->Set(Nan::New<String>("FETCH_ARRAY").ToLocalChecked(), Nan::New<Number>(FETCH_ARRAY), constant_attributes);
  NODE_ODBC_DEFINE_CONSTANT(constructor_template, FETCH_OBJECT);
  
  // Prototype Methods
  Nan::SetPrototypeMethod(constructor_template, "createConnection", CreateConnection);
  Nan::SetPrototypeMethod(constructor_template, "createConnectionSync", CreateConnectionSync);

  // Attach the Database Constructor to the target object
  constructor.Reset(constructor_template->GetFunction());
  exports->Set(Nan::New("ODBC").ToLocalChecked(),
               constructor_template->GetFunction());
  
#if NODE_VERSION_AT_LEAST(0, 7, 9)
  // Initialize uv_async so that we can prevent node from exiting
  //uv_async_init( uv_default_loop(),
  //               &ODBC::g_async,
  //               ODBC::WatcherCallback);
  
  // Not sure if the init automatically calls uv_ref() because there is weird
  // behavior going on. When ODBC::Init is called which initializes the 
  // uv_async_t g_async above, there seems to be a ref which will keep it alive
  // but we only want this available so that we can uv_ref() later on when
  // we have a connection.
  // so to work around this, I am possibly mistakenly calling uv_unref() once
  // so that there are no references on the loop.
  //uv_unref((uv_handle_t *)&ODBC::g_async);
#endif
  
  // Initialize the cross platform mutex provided by libuv
  uv_mutex_init(&ODBC::g_odbcMutex);
}
开发者ID:rkamaleswaran,项目名称:physioEx,代码行数:50,代码来源:odbc.cpp

示例12: Init

void XpcConnection::Init(v8::Handle<v8::Object> target) {
  v8::HandleScope scope;

  v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(XpcConnection::New);

  s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
  s_ct->InstanceTemplate()->SetInternalFieldCount(1);
  s_ct->SetClassName(v8::String::NewSymbol("XpcConnection"));

  NODE_SET_PROTOTYPE_METHOD(s_ct, "setup", XpcConnection::Setup);
  NODE_SET_PROTOTYPE_METHOD(s_ct, "sendMessage", XpcConnection::SendMessage);

  target->Set(v8::String::NewSymbol("XpcConnection"), s_ct->GetFunction());
}
开发者ID:PolyPEDAL,项目名称:DashboardTeleoperation,代码行数:14,代码来源:XpcConnection.cpp

示例13:

static v8::Handle<v8::FunctionTemplate> ConfigureV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::internalFieldCount,
        V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes),
        0, 0, isolate, currentWorldType);
    UNUSED_PARAM(defaultSignature);

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:14,代码来源:V8TestException.cpp

示例14: batchConfigureCallbacks

void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> proto, 
                             v8::Handle<v8::Signature> signature, 
                             v8::PropertyAttribute attributes,
                             const BatchedCallback* callbacks,
                             size_t callbackCount)
{
    for (size_t i = 0; i < callbackCount; ++i) {
        proto->Set(v8::String::New(callbacks[i].name),
                   v8::FunctionTemplate::New(callbacks[i].callback, 
                                             v8::Handle<v8::Value>(),
                                             signature),
                   attributes);
    }
}
开发者ID:besk,项目名称:MT6589_kernel_source,代码行数:14,代码来源:V8Proxy.cpp

示例15: Init

void NodeRequest::Init(v8::Handle<v8::Object> target) {
    NanScope();

    v8::Local<v8::FunctionTemplate> t = NanNew<v8::FunctionTemplate>(New);

    t->InstanceTemplate()->SetInternalFieldCount(1);
    t->SetClassName(NanNew("Request"));

    NODE_SET_PROTOTYPE_METHOD(t, "respond", Respond);

    NanAssignPersistent(constructorTemplate, t);

    target->Set(NanNew("Request"), t->GetFunction());
}
开发者ID:ExtremeXiang,项目名称:mapbox-gl-native,代码行数:14,代码来源:node_request.cpp


注:本文中的v8::Handle::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。