v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::Template Class Reference

#include <v8-template.h>

Inheritance diagram for v8::Template:
Collaboration diagram for v8::Template:

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, PropertyAttribute attributes=None)
 
void SetAccessorProperty (Local< Name > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None)
 
void SetNativeDataProperty (Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, 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)
 
- Public Member Functions inherited from v8::Data
bool IsValue () const
 
bool IsModule () const
 
bool IsModuleRequest () const
 
bool IsFixedArray () const
 
bool IsPrivate () const
 
bool IsObjectTemplate () const
 
bool IsFunctionTemplate () const
 
bool IsContext () const
 

Private Member Functions

 Template ()
 

Friends

class ObjectTemplate
 
class FunctionTemplate
 

Detailed Description

The superclass of object and function templates.

Definition at line 50 of file v8-template.h.

Constructor & Destructor Documentation

◆ Template()

v8::Template::Template ( )
private

Member Function Documentation

◆ Set() [1/2]

void v8::Template::Set ( Isolate * isolate,
const char * name,
Local< Data > value,
PropertyAttribute attributes = None )

Definition at line 1122 of file v8-template.h.

Here is the call graph for this function:

◆ Set() [2/2]

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 954 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAccessorProperty()

void v8::Template::SetAccessorProperty ( Local< Name > name,
v8::Local< FunctionTemplate > getter = Local<FunctionTemplate>(),
v8::Local< FunctionTemplate > setter = Local<FunctionTemplate>(),
v8::PropertyAttribute attribute = None )

Sets an "accessor property" on the object template, see https://tc39.es/ecma262/#sec-object-type.

Whenever the property with the given name is accessed on objects created from this ObjectTemplate the getter and setter functions are called.

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.
attributeThe attributes of the property for which an accessor is added.

Definition at line 983 of file api.cc.

Here is the call graph for this function:

◆ 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 1455 of file api.cc.

Here is the call graph for this function:

◆ 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 1444 of file api.cc.

◆ SetNativeDataProperty()

void v8::Template::SetNativeDataProperty ( v8::Local< Name > name,
AccessorNameGetterCallback getter,
AccessorNameSetterCallback setter = nullptr,
v8::Local< Value > data = Local<Value>(),
PropertyAttribute attribute = None,
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect )

Sets a "data property" on the object template, see https://tc39.es/ecma262/#sec-object-type.

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. Note that in case a property is written via a "child" object, the setter will not be called according to the JavaScript specification. See https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver.

Parameters
nameThe name of the data 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.
attributeThe attributes of the property for which an accessor is added.

Definition at line 1433 of file api.cc.

◆ SetPrivate()

void v8::Template::SetPrivate ( v8::Local< Private > name,
v8::Local< Data > value,
v8::PropertyAttribute attribute = None )

Definition at line 978 of file api.cc.

Friends And Related Symbol Documentation

◆ FunctionTemplate

friend class FunctionTemplate
friend

Definition at line 132 of file v8-template.h.

◆ ObjectTemplate

friend class ObjectTemplate
friend

Definition at line 131 of file v8-template.h.


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