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


C++ Local::SetAccessor方法代码示例

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


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

示例1: scope

void JNIV8ClassInfo::_registerAccessor(JNIV8ObjectAccessorHolder *holder) {
    Isolate* isolate = engine->getIsolate();
    HandleScope scope(isolate);

    Local<FunctionTemplate> ft = Local<FunctionTemplate>::New(isolate, functionTemplate);

    accessorHolders.push_back(holder);
    Local<External> data = External::New(isolate, (void*)holder);

    AccessorNameSetterCallback finalSetter = 0;
    v8::PropertyAttribute settings = v8::PropertyAttribute::None;
    if(holder->setterCallback.i || holder->setterCallback.s) {
        finalSetter = v8AccessorSetterCallback;
    } else {
        settings = v8::PropertyAttribute::ReadOnly;
    }

    if(holder->isStatic) {
        Local<Function> f = ft->GetFunction();
        f->SetAccessor(engine->getContext(), String::NewFromUtf8(isolate, holder->propertyName.c_str()),
                       v8AccessorGetterCallback, finalSetter,
                       data, DEFAULT, settings);
    } else {
        Local<ObjectTemplate> instanceTpl = ft->InstanceTemplate();
        instanceTpl->SetAccessor(String::NewFromUtf8(isolate, holder->propertyName.c_str()),
                                 v8AccessorGetterCallback, finalSetter,
                                 data, DEFAULT, settings);
    }
}
开发者ID:godmodelabs,项目名称:ejecta-v8,代码行数:29,代码来源:JNIV8ClassInfo.cpp

示例2: context_scope

   v8::Handle<v8::Object> WrapScreen(ScriptSystem* ss)
   {
      HandleScope handle_scope;
      Handle<Context> context = ss->GetGlobalContext();
      Context::Scope context_scope(context);

      Handle<FunctionTemplate> templt = FunctionTemplate::New();
      templt->SetClassName(String::New("Screen"));

      Handle<ObjectTemplate> proto = templt->PrototypeTemplate();

      proto->Set("toString", FunctionTemplate::New(SCRToString));
      proto->Set("getPickRay", FunctionTemplate::New(SCRGetPickRay));
      proto->Set("intersect", FunctionTemplate::New(SCRIntersect));
      proto->Set("pickEntity", FunctionTemplate::New(SCRPickEntity));
      proto->Set("convertWorldToScreenCoords", FunctionTemplate::New(SCRConvertWorldToScreenCoords));
      proto->Set("openWindow", FunctionTemplate::New(SCROpenWindow));
      proto->Set("closeWindow", FunctionTemplate::New(SCRCloseWindow));
      proto->Set("getWindowGeometry", FunctionTemplate::New(SCRGetWindowGeometry));
      proto->Set("setWindowGeometry", FunctionTemplate::New(SCRSetWindowGeometry));

      Local<Object> instance = templt->GetFunction()->NewInstance();

      instance->SetAccessor(String::New("lockCursor"), SCRGetLockCursor, SCRSetLockCursor);
      instance->SetAccessor(String::New("showCursor"), SCRGetShowCursor, SCRSetShowCursor);
      instance->SetAccessor(String::New("width"), SCRGetWidth);
      instance->SetAccessor(String::New("height"), SCRGetHeight);
      instance->SetAccessor(String::New("fullScreen"), SCRGetFullScreen, SCRSetFullScreen);

      return handle_scope.Close(instance);
   }
开发者ID:mathieu,项目名称:dtEntity,代码行数:31,代码来源:screenwrapper.cpp

示例3: handle_scope

Local<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate(
    Isolate* isolate) {
  EscapableHandleScope handle_scope(isolate);

  Local<ObjectTemplate> result = ObjectTemplate::New(isolate);
  result->SetInternalFieldCount(1);

  // Add accessors for each of the fields of the request.
  result->SetAccessor(
      String::NewFromUtf8(isolate, "path", NewStringType::kInternalized)
          .ToLocalChecked(),
      GetPath);
  result->SetAccessor(
      String::NewFromUtf8(isolate, "referrer", NewStringType::kInternalized)
          .ToLocalChecked(),
      GetReferrer);
  result->SetAccessor(
      String::NewFromUtf8(isolate, "host", NewStringType::kInternalized)
          .ToLocalChecked(),
      GetHost);
  result->SetAccessor(
      String::NewFromUtf8(isolate, "userAgent", NewStringType::kInternalized)
          .ToLocalChecked(),
      GetUserAgent);

  // Again, return the result through the current handle scope.
  return handle_scope.Escape(result);
}
开发者ID:ACEZLY,项目名称:server,代码行数:28,代码来源:V8_Process.cpp

示例4: if

Local<Object> PairNodeIterator::New(int type, MapType::const_iterator new_iter, MapType::const_iterator new_end) {
    Handle<FunctionTemplate> tmplt;
    if ((PairNodeIterator::KEY_TYPE & type) && (PairNodeIterator::VALUE_TYPE & type)) {
        tmplt = NanNew<FunctionTemplate>(key_value_tmplt);
    } else if (KEY_TYPE & type) {
        tmplt = NanNew<FunctionTemplate>(key_tmplt);
    } else {
        tmplt = NanNew<FunctionTemplate>(value_tmplt);
    }

    Local<Object> obj = tmplt->InstanceTemplate()->NewInstance();
    PairNodeIterator *iter = new PairNodeIterator(new_iter, new_end);

    iter->Wrap(obj);

    Local<String> key = NanNew<String>("key");
    Local<String> value = NanNew<String>("value");
    Local<String> done = NanNew<String>("done");

    if (PairNodeIterator::KEY_TYPE & type) {
        obj->SetAccessor(key, GetKey);
    }
    if (PairNodeIterator::VALUE_TYPE & type) {
        obj->SetAccessor(value, GetValue);
    }

    obj->SetAccessor(done, GetDone);

    return obj;
}
开发者ID:njudah,项目名称:node-hashtable,代码行数:30,代码来源:iterator.cpp

示例5:

Handle<FunctionTemplate> PushbotsModule::getProxyTemplate()
{
	if (!proxyTemplate.IsEmpty()) {
		return proxyTemplate;
	}

	LOGD(TAG, "GetProxyTemplate");

	javaClass = titanium::JNIUtil::findClass("com/pushbots/android/PushbotsModule");
	HandleScope scope;

	// use symbol over string for efficiency
	Handle<String> nameSymbol = String::NewSymbol("Pushbots");

	Handle<FunctionTemplate> t = titanium::Proxy::inheritProxyTemplate(
		titanium::KrollModule::getProxyTemplate()
, javaClass, nameSymbol);

	proxyTemplate = Persistent<FunctionTemplate>::New(t);
	proxyTemplate->Set(titanium::Proxy::inheritSymbol,
		FunctionTemplate::New(titanium::Proxy::inherit<PushbotsModule>)->GetFunction());

	titanium::ProxyFactory::registerProxyPair(javaClass, *proxyTemplate);

	// Method bindings --------------------------------------------------------
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "setPushEnabled", PushbotsModule::setPushEnabled);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "tag", PushbotsModule::tag);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "example", PushbotsModule::example);

	Local<ObjectTemplate> prototypeTemplate = proxyTemplate->PrototypeTemplate();
	Local<ObjectTemplate> instanceTemplate = proxyTemplate->InstanceTemplate();

	// Delegate indexed property get and set to the Java proxy.
	instanceTemplate->SetIndexedPropertyHandler(titanium::Proxy::getIndexedProperty,
		titanium::Proxy::setIndexedProperty);

	// Constants --------------------------------------------------------------

	// Dynamic properties -----------------------------------------------------
	instanceTemplate->SetAccessor(String::NewSymbol("alias"),
			titanium::Proxy::getProperty
			, PushbotsModule::setter_alias
, Handle<Value>(), DEFAULT);
	instanceTemplate->SetAccessor(String::NewSymbol("enabled"),
			PushbotsModule::getter_enabled
			, PushbotsModule::setter_enabled
, Handle<Value>(), DEFAULT);
	instanceTemplate->SetAccessor(String::NewSymbol("exampleProp"),
			PushbotsModule::getter_exampleProp
			, PushbotsModule::setter_exampleProp
, Handle<Value>(), DEFAULT);

	// Accessors --------------------------------------------------------------

	return proxyTemplate;
}
开发者ID:appcelerator-forks,项目名称:drmas.Pushbots,代码行数:56,代码来源:com.pushbots.android.PushbotsModule.cpp

示例6: HttpClientInitBinding

void HttpClientInitBinding(Handle<Object> target) {
	NanScope();
	Local<FunctionTemplate> ctor = NanNew<FunctionTemplate>(newHttpClient);
	NanAssignPersistent(constructor, ctor);
	ctor->InstanceTemplate()->SetInternalFieldCount(1);
	ctor->SetClassName(NanNew("HttpClient"));
	Local<ObjectTemplate> proto = ctor->PrototypeTemplate();
	
	proto->SetAccessor(NanNew("url"), HttpClientGetUrl, HttpClientSetUrl);
	proto->SetAccessor(NanNew("returnType"), HttpClientGetReturnType, HttpClientSetReturnType);
	proto->SetAccessor(NanNew("method"), HttpClientGetMethod, HttpClientSetMethod);
	proto->SetAccessor(NanNew("requestHeaders"), HttpClientGetRequestHeaders, HttpClientSetRequestHeaders);
	proto->SetAccessor(NanNew("requestData"), HttpClientGetRequestData, HttpClientSetRequestData);
	proto->SetAccessor(NanNew("status"), HttpClientGetStatus, HttpClientSetStatus);
	proto->SetAccessor(NanNew("statusText"), HttpClientGetStatusText, HttpClientSetStatusText);
	proto->SetAccessor(NanNew("responseHeaders"), HttpClientGetResponseHeaders, HttpClientSetResponseHeaders);
	proto->SetAccessor(NanNew("responseText"), HttpClientGetResponseText, HttpClientSetResponseText);

	NAN_SET_PROTOTYPE_METHOD(ctor, "send", HttpClientSend);


	target->Set(NanNew("HttpClient"), ctor->GetFunction());

	HttpClient::init();
}
开发者ID:csyangbinbin,项目名称:cantk-runtime-v8,代码行数:25,代码来源:HttpClientBinding.cpp

示例7:

Handle<FunctionTemplate> ExampleProxy::getProxyTemplate()
{
	if (!proxyTemplate.IsEmpty()) {
		return proxyTemplate;
	}

	LOGD(TAG, "GetProxyTemplate");

	javaClass = titanium::JNIUtil::findClass("ro/mihaiblaga/imei/ExampleProxy");
	HandleScope scope;

	// use symbol over string for efficiency
	Handle<String> nameSymbol = String::NewSymbol("Example");

	Handle<FunctionTemplate> t = titanium::Proxy::inheritProxyTemplate(
		titanium::TiViewProxy::getProxyTemplate()
, javaClass, nameSymbol);

	proxyTemplate = Persistent<FunctionTemplate>::New(t);
	proxyTemplate->Set(titanium::Proxy::inheritSymbol,
		FunctionTemplate::New(titanium::Proxy::inherit<ExampleProxy>)->GetFunction());

	titanium::ProxyFactory::registerProxyPair(javaClass, *proxyTemplate);

	// Method bindings --------------------------------------------------------
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "setMessage", ExampleProxy::setMessage);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "getMessage", ExampleProxy::getMessage);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "printMessage", ExampleProxy::printMessage);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "getImei", ExampleProxy::getImei);

	Local<ObjectTemplate> prototypeTemplate = proxyTemplate->PrototypeTemplate();
	Local<ObjectTemplate> instanceTemplate = proxyTemplate->InstanceTemplate();

	// Delegate indexed property get and set to the Java proxy.
	instanceTemplate->SetIndexedPropertyHandler(titanium::Proxy::getIndexedProperty,
		titanium::Proxy::setIndexedProperty);

	// Constants --------------------------------------------------------------

	// Dynamic properties -----------------------------------------------------
	instanceTemplate->SetAccessor(String::NewSymbol("message"),
			ExampleProxy::getter_message
			, ExampleProxy::setter_message
, Handle<Value>(), DEFAULT);
	instanceTemplate->SetAccessor(String::NewSymbol("imei"),
			ExampleProxy::getter_imei
			, titanium::Proxy::onPropertyChanged
		, Handle<Value>(), DEFAULT);

	// Accessors --------------------------------------------------------------

	return proxyTemplate;
}
开发者ID:morefun0302,项目名称:ro.mihaiblaga.imei,代码行数:53,代码来源:ro.mihaiblaga.imei.ExampleProxy.cpp

示例8:

Handle<FunctionTemplate> NfcTagProxy::getProxyTemplate()
{
	if (!proxyTemplate.IsEmpty()) {
		return proxyTemplate;
	}

	LOGD(TAG, "GetProxyTemplate");

	javaClass = titanium::JNIUtil::findClass("ta/nfc/NfcTagProxy");
	HandleScope scope;

	// use symbol over string for efficiency
	Handle<String> nameSymbol = String::NewSymbol("NfcTag");

	Handle<FunctionTemplate> t = titanium::Proxy::inheritProxyTemplate(
		titanium::KrollProxy::getProxyTemplate()
, javaClass, nameSymbol);

	proxyTemplate = Persistent<FunctionTemplate>::New(t);
	proxyTemplate->Set(titanium::Proxy::inheritSymbol,
		FunctionTemplate::New(titanium::Proxy::inherit<NfcTagProxy>)->GetFunction());

	titanium::ProxyFactory::registerProxyPair(javaClass, *proxyTemplate);

	// Method bindings --------------------------------------------------------
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "getId", NfcTagProxy::getId);
	DEFINE_PROTOTYPE_METHOD(proxyTemplate, "getTechList", NfcTagProxy::getTechList);

	Local<ObjectTemplate> prototypeTemplate = proxyTemplate->PrototypeTemplate();
	Local<ObjectTemplate> instanceTemplate = proxyTemplate->InstanceTemplate();

	// Delegate indexed property get and set to the Java proxy.
	instanceTemplate->SetIndexedPropertyHandler(titanium::Proxy::getIndexedProperty,
		titanium::Proxy::setIndexedProperty);

	// Constants --------------------------------------------------------------

	// Dynamic properties -----------------------------------------------------
	instanceTemplate->SetAccessor(String::NewSymbol("id"),
			NfcTagProxy::getter_id
			, titanium::Proxy::onPropertyChanged
		, Handle<Value>(), DEFAULT);
	instanceTemplate->SetAccessor(String::NewSymbol("techList"),
			NfcTagProxy::getter_techList
			, titanium::Proxy::onPropertyChanged
		, Handle<Value>(), DEFAULT);

	// Accessors --------------------------------------------------------------

	return proxyTemplate;
}
开发者ID:elkouriabdelali,项目名称:ta.nfc,代码行数:51,代码来源:ta.nfc.NfcTagProxy.cpp

示例9:

Handle<Object> FixSession::wrapFixSession(FixSession* fixSession) {
	Local<FunctionTemplate> ctor = NanNew<FunctionTemplate>();

	ctor->InstanceTemplate()->SetInternalFieldCount(1);
	ctor->SetClassName(NanNew("FixSession"));

	Local<ObjectTemplate> proto = ctor->PrototypeTemplate();

	NODE_SET_PROTOTYPE_METHOD(ctor, "disconnect", disconnect);
	NODE_SET_PROTOTYPE_METHOD(ctor, "getSessionID", getSessionID);
	NODE_SET_PROTOTYPE_METHOD(ctor, "isEnabled", isEnabled);
	NODE_SET_PROTOTYPE_METHOD(ctor, "isLoggedOn", isLoggedOn);
	NODE_SET_PROTOTYPE_METHOD(ctor, "logon", logon);
	NODE_SET_PROTOTYPE_METHOD(ctor, "logout", logout);
	NODE_SET_PROTOTYPE_METHOD(ctor, "refresh", refresh);
	NODE_SET_PROTOTYPE_METHOD(ctor, "reset", reset);

	proto->SetAccessor(NanNew("senderSeqNum"), getSenderSeqNum, setSenderSeqNum);
	proto->SetAccessor(NanNew("targetSeqNum"), getTargetSeqNum, setTargetSeqNum);

	Handle<Object> obj = ctor->InstanceTemplate()->NewInstance();

	//obj->SetAlignedPointerInInternalField(0, NanNew<External>(fixSession));
	fixSession->Wrap(obj);
	return obj;
}
开发者ID:Luka111,项目名称:node-fix-middleware,代码行数:26,代码来源:FixSession.cpp

示例10: Init

void Init(Isolate * isolate)
{
	Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
	tpl->SetClassName(v8::String::NewFromUtf8(isolate, "Transformable"));
	tpl->InstanceTemplate()->SetInternalFieldCount(2);
	Local<ObjectTemplate> proto = tpl->PrototypeTemplate();
//	proto->SetInternalFieldCount(1);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "x"), GetX, SetX);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "y"), GetY, SetY);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "rotation"), GetRotation, SetRotation);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "scaleX"), GetScaleX, SetScaleX);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "scaleY"), GetScaleY, SetScaleY);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "originX"), GetOriginX, SetOriginX);
	proto->SetAccessor(v8::String::NewFromUtf8(isolate, "originY"), GetOriginY, SetOriginY);
	tpl_ref.Reset(isolate, tpl);
}
开发者ID:seobyeongky,项目名称:gunman,代码行数:16,代码来源:v8_transformable.cpp

示例11: initClass

static v8::Local<v8::Function> initClass(v8::Handle<v8::FunctionTemplate>& temp) {
    HandleScope scope;

    Local<ObjectTemplate> obj = temp->PrototypeTemplate();
    obj->SetAccessor(String::New("height"), height);
    obj->SetAccessor(String::New("ascender"), ascender);
    obj->SetAccessor(String::New("descender"), descender);

    EXPOSE_METHOD(obj, load, ReadOnly | DontDelete);
    EXPOSE_METHOD(obj, measure, ReadOnly | DontDelete);
    EXPOSE_METHOD(obj, glyphs, ReadOnly | DontDelete);
    EXPOSE_METHOD(obj, outline_type, ReadOnly | DontDelete);
    EXPOSE_METHOD(obj, outline_thickness, ReadOnly | DontDelete);

    return scope.Close(temp->GetFunction());
}
开发者ID:hurry07,项目名称:v8,代码行数:16,代码来源:Font.cpp

示例12: InjectPrototype

void MetadataNode::InjectPrototype(Local<Object>& target, Local<Object>& implementationObject)
{
	auto isolate = Isolate::GetCurrent();

	implementationObject->SetAccessor(ConvertToV8String("super"), SuperAccessorGetterCallback, nullptr, implementationObject);
	implementationObject->SetPrototype(target->GetPrototype());
	target->SetPrototype(implementationObject);
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:8,代码来源:MetadataNode.cpp

示例13: scope

void CanvasRenderingContext2D::Create(const v8::FunctionCallbackInfo<v8::Value>& args)
{
	auto isolate = args.GetIsolate();
	HandleScope scope(isolate);

	Local<ObjectTemplate> contextTemplate = ObjectTemplate::New(isolate);
	contextTemplate->SetInternalFieldCount(1);

	contextTemplate->Set(ConvertToV8String("__draw"), FunctionTemplate::New(isolate, &Draw));
	contextTemplate->Set(ConvertToV8String("__sizeChanged"), FunctionTemplate::New(isolate, &SizeChanged));

	contextTemplate->SetAccessor(ConvertToV8String("fillStyle"), &GetFillStyle, &SetFillStyle);
	contextTemplate->SetAccessor(ConvertToV8String("strokeStyle"), &GetStrokeStyle, &SetStrokeStyle);

	contextTemplate->Set(ConvertToV8String("arc"), FunctionTemplate::New(isolate, &Arc));
	contextTemplate->Set(ConvertToV8String("beginPath"), FunctionTemplate::New(isolate, &BeginPath));
	contextTemplate->Set(ConvertToV8String("bezierCurveTo"), FunctionTemplate::New(isolate, &BezierCurveTo));
	contextTemplate->Set(ConvertToV8String("clearRect"), FunctionTemplate::New(isolate, &ClearRect));
	contextTemplate->Set(ConvertToV8String("closePath"), FunctionTemplate::New(isolate, &ClosePath));
	contextTemplate->Set(ConvertToV8String("drawImage"), FunctionTemplate::New(isolate, &DrawImage));
	contextTemplate->Set(ConvertToV8String("fill"), FunctionTemplate::New(isolate, &Fill));
	contextTemplate->Set(ConvertToV8String("fillRect"), FunctionTemplate::New(isolate, &FillRect));
	contextTemplate->Set(ConvertToV8String("fillText"), FunctionTemplate::New(isolate, &FillText));
	contextTemplate->Set(ConvertToV8String("getImageData"), FunctionTemplate::New(isolate, &GetImageData));
	contextTemplate->Set(ConvertToV8String("lineTo"), FunctionTemplate::New(isolate, &LineTo));
	contextTemplate->Set(ConvertToV8String("measureText"), FunctionTemplate::New(isolate, &MeasureText));
	contextTemplate->Set(ConvertToV8String("moveTo"), FunctionTemplate::New(isolate, &MoveTo));
	contextTemplate->Set(ConvertToV8String("quadraticCurveTo"), FunctionTemplate::New(isolate, &QuadraticCurveTo));
	contextTemplate->Set(ConvertToV8String("restore"), FunctionTemplate::New(isolate, &Restore));
	contextTemplate->Set(ConvertToV8String("rotate"), FunctionTemplate::New(isolate, &Rotate));
	contextTemplate->Set(ConvertToV8String("save"), FunctionTemplate::New(isolate, &Save));
	contextTemplate->Set(ConvertToV8String("stroke"), FunctionTemplate::New(isolate, &Stroke));
	contextTemplate->Set(ConvertToV8String("translate"), FunctionTemplate::New(isolate, &Translate));

	Local<Object> newContext = contextTemplate->NewInstance();
	newContext->ForceSet(ConvertToV8String("canvas"), args[0]);
	newContext->ForceSet(ConvertToV8String("__kind"), ConvertToV8String("2d"));

	auto nativeContext = new CanvasRenderingContext2D();
	newContext->SetInternalField(0, External::New(isolate, nativeContext));

	Persistent<Object> persistentHandle(isolate, newContext);
	persistentHandle.SetWeak(nativeContext, &Deallocate);

	args.GetReturnValue().Set(newContext);
}
开发者ID:NativeScript,项目名称:nativescript-canvas,代码行数:46,代码来源:CanvasRenderingContext2D.cpp

示例14: RegisterMyClass

void RegisterMyClass(Isolate* isolate, Local<ObjectTemplate> global)
{
	Local<ObjectTemplate> localTemplate = ObjectTemplate::New(isolate);
	localTemplate->SetInternalFieldCount(1);

	localTemplate->SetAccessor(
		String::NewFromUtf8(isolate, "num", NewStringType::kInternalized)
		.ToLocalChecked(),
		jsMyClassGetNumber,
		jsMyClassSetNumber);
	localTemplate->SetAccessor(
		String::NewFromUtf8(isolate, "name", NewStringType::kInternalized)
		.ToLocalChecked(),
		jsMyClassGetName,
		jsMyClassSetName);
	localTemplate->Set(
		String::NewFromUtf8(isolate, "Method1", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsMyClassMethod1));
	localTemplate->Set(
		String::NewFromUtf8(isolate, "Method2", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsMyClassMethod2));

	gMyClassTemplate.Reset(isolate, localTemplate);

	global->Set(
		String::NewFromUtf8(isolate, "MyClass", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsCreateMyClass));
	global->Set(
		String::NewFromUtf8(isolate, "jsMyFunction", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsMyFunction));
	global->Set(
		String::NewFromUtf8(isolate, "jsMyFunction1", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsMyFunction1));
	global->Set(
		String::NewFromUtf8(isolate, "jsMyFunction2", NewStringType::kNormal)
		.ToLocalChecked(),
		FunctionTemplate::New(isolate, jsMyFunction2));
}
开发者ID:ACEZLY,项目名称:server,代码行数:43,代码来源:MyClass_Wrap.cpp

示例15: initClass

static v8::Local<v8::Function> initClass(v8::Handle<v8::FunctionTemplate>& temp) {
    HandleScope scope;

    Local<ObjectTemplate> obj = temp->PrototypeTemplate();
    obj->SetAccessor(String::New("byteLength"), byteLength);
    EXPOSE_METHOD(obj, slice, ReadOnly | DontDelete);
    EXPOSE_METHOD(obj, isView, ReadOnly | DontDelete);
    obj->Set(String::New("clone"), FunctionTemplate::New(ClassWrap<NodeBuffer>::clone));

    return scope.Close(temp->GetFunction());
}
开发者ID:hurry07,项目名称:opengl_android,代码行数:11,代码来源:arraybuffer.cpp


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