![]() |
v8 11.3.244 (node 20.3.0)
V8 is Google's open source JavaScript engine
|
#include <v8-template.h>
Friends | |
class | ObjectTemplate |
class | FunctionTemplate |
The superclass of object and function templates.
Definition at line 46 of file v8-template.h.
void Set | ( | Isolate * | isolate, |
const char * | name, | ||
Local< Data > | value, | ||
PropertyAttribute | attributes = None |
||
) |
Definition at line 988 of file v8-template.h.
References v8::kInternalized, and String::NewFromUtf8().
Adds a property to each instance created by this template.
The property must be defined either as a primitive value, or a template.
void SetAccessorProperty | ( | Local< Name > | name, |
Local< FunctionTemplate > | getter = Local< FunctionTemplate >() , |
||
Local< FunctionTemplate > | setter = Local< FunctionTemplate >() , |
||
PropertyAttribute | attribute = None , |
||
AccessControl | settings = DEFAULT |
||
) |
void SetIntrinsicDataProperty | ( | Local< Name > | name, |
Intrinsic | intrinsic, | ||
PropertyAttribute | attribute = None |
||
) |
During template instantiation, sets the value with the intrinsic property from the correct context.
void SetLazyDataProperty | ( | Local< Name > | name, |
AccessorNameGetterCallback | getter, | ||
Local< Value > | data = Local< Value >() , |
||
PropertyAttribute | attribute = None , |
||
SideEffectType | getter_side_effect_type = SideEffectType::kHasSideEffect , |
||
SideEffectType | setter_side_effect_type = SideEffectType::kHasSideEffect |
||
) |
Like SetNativeDataProperty, but V8 will replace the native data property with a real data property on first access.
void SetNativeDataProperty | ( | Local< Name > | name, |
AccessorNameGetterCallback | getter, | ||
AccessorNameSetterCallback | setter = nullptr , |
||
Local< Value > | data = Local< Value >() , |
||
PropertyAttribute | attribute = None , |
||
AccessControl | settings = DEFAULT , |
||
SideEffectType | getter_side_effect_type = SideEffectType::kHasSideEffect , |
||
SideEffectType | setter_side_effect_type = SideEffectType::kHasSideEffect |
||
) |
void SetNativeDataProperty | ( | Local< String > | name, |
AccessorGetterCallback | getter, | ||
AccessorSetterCallback | setter = nullptr , |
||
Local< Value > | data = Local< Value >() , |
||
PropertyAttribute | attribute = None , |
||
AccessControl | settings = DEFAULT , |
||
SideEffectType | getter_side_effect_type = SideEffectType::kHasSideEffect , |
||
SideEffectType | setter_side_effect_type = SideEffectType::kHasSideEffect |
||
) |
Whenever the property with the given name is accessed on objects created from this Template the getter and setter callbacks are called instead of getting and setting the property directly on the JavaScript object.
name | The name of the property for which an accessor is added. |
getter | The callback to invoke when getting the property. |
setter | The callback to invoke when setting the property. |
data | A piece of data that will be passed to the getter and setter callbacks whenever they are invoked. |
settings | Access control settings for the accessor. This is a bit field consisting of one of more of DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2. The default is to not allow cross-context access. ALL_CAN_READ means that all cross-context reads are allowed. ALL_CAN_WRITE means that all cross-context writes are allowed. The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all cross-context access. |
attribute | The attributes of the property for which an accessor is added. |
|
friend |
Definition at line 124 of file v8-template.h.
|
friend |
Definition at line 123 of file v8-template.h.