V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
|
#include <v8.h>
Public Member Functions | |
V8_DEPRECATED ("Use maybe version", Local< Object > NewInstance()) | |
V8_WARN_UNUSED_RESULT MaybeLocal< Object > | NewInstance (Local< Context > context) |
void | SetAccessor (Local< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect) |
void | SetAccessor (Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect) |
void | SetHandler (const NamedPropertyHandlerConfiguration &configuration) |
void | SetIndexedPropertyHandler (IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=nullptr, IndexedPropertyQueryCallback query=nullptr, IndexedPropertyDeleterCallback deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >()) |
void | SetHandler (const IndexedPropertyHandlerConfiguration &configuration) |
void | SetCallAsFunctionHandler (FunctionCallback callback, Local< Value > data=Local< Value >()) |
void | MarkAsUndetectable () |
void | SetAccessCheckCallback (AccessCheckCallback callback, Local< Value > data=Local< Value >()) |
void | SetAccessCheckCallbackAndHandler (AccessCheckCallback callback, const NamedPropertyHandlerConfiguration &named_handler, const IndexedPropertyHandlerConfiguration &indexed_handler, Local< Value > data=Local< Value >()) |
int | InternalFieldCount () |
void | SetInternalFieldCount (int value) |
bool | IsImmutableProto () |
void | SetImmutableProto () |
Public Member Functions inherited from v8::Template | |
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) |
Static Public Member Functions | |
static Local< ObjectTemplate > | New (Isolate *isolate, Local< FunctionTemplate > constructor=Local< FunctionTemplate >()) |
static MaybeLocal< ObjectTemplate > | FromSnapshot (Isolate *isolate, size_t index) |
static V8_INLINE ObjectTemplate * | Cast (Data *data) |
Friends | |
class | FunctionTemplate |
An ObjectTemplate is used to create objects at runtime.
Properties added to an ObjectTemplate are added to each object created from the ObjectTemplate.
|
static |
int v8::ObjectTemplate::InternalFieldCount | ( | ) |
bool v8::ObjectTemplate::IsImmutableProto | ( | ) |
void v8::ObjectTemplate::MarkAsUndetectable | ( | ) |
|
static |
Creates an ObjectTemplate.
void v8::ObjectTemplate::SetAccessCheckCallback | ( | AccessCheckCallback | callback, |
Local< Value > | data = Local<Value>() |
||
) |
void v8::ObjectTemplate::SetAccessCheckCallbackAndHandler | ( | AccessCheckCallback | callback, |
const NamedPropertyHandlerConfiguration & | named_handler, | ||
const IndexedPropertyHandlerConfiguration & | indexed_handler, | ||
Local< Value > | data = Local<Value>() |
||
) |
void v8::ObjectTemplate::SetAccessor | ( | v8::Local< String > | name, |
AccessorGetterCallback | getter, | ||
AccessorSetterCallback | setter = nullptr , |
||
v8::Local< Value > | data = Local<Value>() , |
||
AccessControl | settings = DEFAULT , |
||
PropertyAttribute | attribute = None , |
||
v8::Local< AccessorSignature > | signature = Local<AccessorSignature>() , |
||
SideEffectType | getter_side_effect_type = SideEffectType::kHasSideEffect , |
||
SideEffectType | setter_side_effect_type = SideEffectType::kHasSideEffect |
||
) |
Sets an accessor on the object template.
Whenever the property with the given name is accessed on objects created from this ObjectTemplate 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. |
signature | The 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. |
void v8::ObjectTemplate::SetHandler | ( | const NamedPropertyHandlerConfiguration & | configuration | ) |
Sets a named property handler on the object template.
Whenever a property whose name is a string or a symbol is accessed on objects created from this object template, the provided callback is invoked instead of accessing the property directly on the JavaScript object.
configuration | The NamedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property. |
void v8::ObjectTemplate::SetHandler | ( | const IndexedPropertyHandlerConfiguration & | configuration | ) |
Sets an indexed property handler on the object template.
Whenever an indexed property is accessed on objects created from this object template, the provided callback is invoked instead of accessing the property directly on the JavaScript object.
configuration | The IndexedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property. |
void v8::ObjectTemplate::SetImmutableProto | ( | ) |
Makes the ObjectTemplate for an immutable prototype exotic object, with an immutable proto.
|
inline |
Sets an indexed property handler on the object template.
Whenever an indexed property is accessed on objects created from this object template, the provided callback is invoked instead of accessing the property directly on the JavaScript object.
getter | The callback to invoke when getting a property. |
setter | The callback to invoke when setting a property. |
query | The callback to invoke to check if an object has a property. |
deleter | The callback to invoke when deleting a property. |
enumerator | The callback to invoke to enumerate all the indexed properties of an object. |
data | A piece of data that will be passed to the callbacks whenever they are invoked. |
void v8::ObjectTemplate::SetInternalFieldCount | ( | int | value | ) |
Creates a new instance of this template.