本文整理汇总了C++中Global::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Global::Reset方法的具体用法?C++ Global::Reset怎么用?C++ Global::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Global
的用法示例。
在下文中一共展示了Global::Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: registerTemplates
void ModuleByteArray::registerTemplates(v8::Isolate* isolate, Local<ObjectTemplate> globalObject)
{
HandleScope handle_scope(isolate);
Local<ObjectTemplate> object = ObjectTemplate::New(isolate);
// Create function template for our constructor it will call the constructByteArray function
Local<FunctionTemplate> constructorTemplate = FunctionTemplate::New(isolate, constructByteArray);
constructorTemplate->SetClassName(String::NewFromUtf8(isolate, "ByteArray"));
// Define function added to each instance
Local<ObjectTemplate> constructorInstanceTemplate = constructorTemplate->InstanceTemplate();
constructorInstanceTemplate->SetInternalFieldCount(1);
constructorInstanceTemplate->Set(String::NewFromUtf8(isolate, "hex"), FunctionTemplate::New(isolate, hex));
constructorInstanceTemplate->Set(String::NewFromUtf8(isolate, "base64"), FunctionTemplate::New(isolate, base64));
constructorInstanceTemplate->Set(String::NewFromUtf8(isolate, "hash"), FunctionTemplate::New(isolate, hash));
constructorInstanceTemplate->Set(String::NewFromUtf8(isolate, "printable"), FunctionTemplate::New(isolate, printable));
constructorInstanceTemplate->Set(String::NewFromUtf8(isolate, "toString"), FunctionTemplate::New(isolate, toString));
// Store template
ByteArrayTemplate.Reset(isolate, constructorInstanceTemplate);
// Set the function in the global scope -- that is, set "ByteArray" to the constructor
globalObject->Set(String::NewFromUtf8(isolate, "ByteArray"), constructorTemplate);
}
示例3: UnregisterMyClass
void UnregisterMyClass()
{
gMyClassTemplate.Reset();
}