V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
v8::Template Class Reference

#include <v8.h>

Inheritance diagram for v8::Template:
v8::Data v8::FunctionTemplate v8::ObjectTemplate

Public Member Functions

void Set (Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
 
void SetPrivate (Local< Private > name, Local< Data > value, PropertyAttribute attributes=None)
 
V8_INLINE void Set (Isolate *isolate, const char *name, Local< Data > value)
 
void SetAccessorProperty (Local< Name > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
 
void SetNativeDataProperty (Local< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
 
void SetNativeDataProperty (Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
 
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)
 
void SetIntrinsicDataProperty (Local< Name > name, Intrinsic intrinsic, PropertyAttribute attribute=None)
 

Friends

class ObjectTemplate
 
class FunctionTemplate
 

Detailed Description

The superclass of object and function templates.

Definition at line 5287 of file v8.h.

Member Function Documentation

◆ Set()

void v8::Template::Set ( v8::Local< Name name,
v8::Local< Data value,
v8::PropertyAttribute  attribute = None 
)

Adds a property to each instance created by this template.

The property must be defined either as a primitive value, or a template.

Definition at line 1283 of file api.cc.

◆ SetIntrinsicDataProperty()

void v8::Template::SetIntrinsicDataProperty ( Local< Name name,
Intrinsic  intrinsic,
PropertyAttribute  attribute = None 
)

During template instantiation, sets the value with the intrinsic property from the correct context.

Definition at line 1737 of file api.cc.

◆ SetLazyDataProperty()

void v8::Template::SetLazyDataProperty ( v8::Local< Name name,
AccessorNameGetterCallback  getter,
v8::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.

Definition at line 1725 of file api.cc.

◆ SetNativeDataProperty()

void v8::Template::SetNativeDataProperty ( v8::Local< String name,
AccessorGetterCallback  getter,
AccessorSetterCallback  setter = nullptr,
v8::Local< Value data = Local<Value>(),
PropertyAttribute  attribute = None,
v8::Local< AccessorSignature signature = Local<AccessorSignature>(),
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.

Parameters
nameThe name of the property for which an accessor is added.
getterThe callback to invoke when getting the property.
setterThe callback to invoke when setting the property.
dataA piece of data that will be passed to the getter and setter callbacks whenever they are invoked.
settingsAccess 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.
attributeThe attributes of the property for which an accessor is added.
signatureThe signature describes valid receivers for the accessor and is used to perform implicit instance checks against them. If the receiver is incompatible (i.e. is not an instance of the constructor as defined by FunctionTemplate::HasInstance()), an implicit TypeError is thrown and no callback is invoked.

Definition at line 1703 of file api.cc.


The documentation for this class was generated from the following files: