v8  3.28.71 (node 0.12.18)
V8 is Google's open source JavaScript engine
Template Class Reference

#include <v8.h>

Inheritance diagram for Template:
Collaboration diagram for Template:

Public Member Functions

void Set (Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
 
V8_INLINE void Set (Isolate *isolate, const char *name, Handle< Data > value)
 
void SetAccessorProperty (Local< String > 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=0, Handle< Value > data=Handle< Value >(), PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT)
 
bool SetDeclaredAccessor (Local< String > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT)
 

Friends

class ObjectTemplate
 
class FunctionTemplate
 

Detailed Description

The superclass of object and function templates.

Definition at line 3168 of file v8.h.

Member Function Documentation

◆ Set() [1/2]

void Set ( Handle< String name,
Handle< Data value,
PropertyAttribute  attributes = None 
)

Adds a property to each instance created by this template.

Referenced by Template::Set().

◆ Set() [2/2]

void Set ( Isolate isolate,
const char *  name,
v8::Handle< Data value 
)

Definition at line 6188 of file v8.h.

References String::NewFromUtf8(), and Template::Set().

◆ SetAccessorProperty()

void SetAccessorProperty ( Local< String name,
Local< FunctionTemplate getter = LocalFunctionTemplate >(),
Local< FunctionTemplate setter = LocalFunctionTemplate >(),
PropertyAttribute  attribute = None,
AccessControl  settings = DEFAULT 
)

◆ SetDeclaredAccessor()

bool SetDeclaredAccessor ( Local< String name,
Local< DeclaredAccessorDescriptor descriptor,
PropertyAttribute  attribute = None,
Local< AccessorSignature signature = LocalAccessorSignature >(),
AccessControl  settings = DEFAULT 
)

◆ SetNativeDataProperty()

void SetNativeDataProperty ( Local< String name,
AccessorGetterCallback  getter,
AccessorSetterCallback  setter = 0,
Handle< Value data = HandleValue >(),
PropertyAttribute  attribute = None,
Local< AccessorSignature signature = LocalAccessorSignature >(),
AccessControl  settings = DEFAULT 
)

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.

Friends And Related Function Documentation

◆ FunctionTemplate

friend class FunctionTemplate
friend

Definition at line 3231 of file v8.h.

◆ ObjectTemplate

friend class ObjectTemplate
friend

Definition at line 3230 of file v8.h.


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