v8  7.9.317(node13.2.0)
V8 is Google's open source JavaScript engine
PropertyCallbackInfo< T > Class Template Reference

#include <v8.h>

Public Member Functions

V8_INLINE IsolateGetIsolate () const
 
V8_INLINE Local< ValueData () const
 
V8_INLINE Local< ObjectThis () const
 
V8_INLINE Local< ObjectHolder () const
 
V8_INLINE ReturnValue< T > GetReturnValue () const
 
V8_INLINE bool ShouldThrowOnError () const
 

Static Public Attributes

static const int kArgsLength = 7
 

Protected Member Functions

V8_INLINE PropertyCallbackInfo (internal::Address *args)
 

Protected Attributes

internal::Addressargs_
 

Static Protected Attributes

static const int kShouldThrowOnErrorIndex = 0
 
static const int kHolderIndex = 1
 
static const int kIsolateIndex = 2
 
static const int kReturnValueDefaultValueIndex = 3
 
static const int kReturnValueIndex = 4
 
static const int kDataIndex = 5
 
static const int kThisIndex = 6
 

Friends

class MacroAssembler
 
class internal::PropertyCallbackArguments
 
class internal::CustomArguments< PropertyCallbackInfo >
 

Detailed Description

template<typename T>
class v8::PropertyCallbackInfo< T >

The information passed to a property callback about the context of the property access.

Definition at line 114 of file v8.h.

Constructor & Destructor Documentation

◆ PropertyCallbackInfo()

V8_INLINE PropertyCallbackInfo ( internal::Address args)
inlineprotected

Definition at line 4283 of file v8.h.

Member Function Documentation

◆ Data()

Local< Value > Data ( ) const
Returns
The data set in the configuration, i.e., in NamedPropertyHandlerConfiguration or IndexedPropertyHandlerConfiguration.

Definition at line 11328 of file v8.h.

◆ GetIsolate()

Isolate * GetIsolate ( ) const
Returns
The isolate of the property access.

Definition at line 11322 of file v8.h.

◆ GetReturnValue()

ReturnValue< T > GetReturnValue ( ) const
Returns
The return value of the callback. Can be changed by calling Set().
info.GetReturnValue().Set(...)

Definition at line 11346 of file v8.h.

◆ Holder()

Local< Object > Holder ( ) const
Returns
The object in the prototype chain of the receiver that has the interceptor. Suppose you have x and its prototype is y, and y has an interceptor. Then info.This() is x and info.Holder() is y. The Holder() could be a hidden object (the global object, rather than the global proxy).
Note
For security reasons, do not pass the object back into the runtime.

Definition at line 11340 of file v8.h.

◆ ShouldThrowOnError()

bool ShouldThrowOnError ( ) const
Returns
True if the intercepted function should throw if an error occurs. Usually, true corresponds to ‘'use strict’`.
Note
Always false when intercepting Reflect.set() independent of the language mode.

Definition at line 11351 of file v8.h.

◆ This()

Local< Object > This ( ) const
Returns
The receiver. In many cases, this is the object on which the property access was intercepted. When using Reflect.get, Function.prototype.call, or similar functions, it is the object passed in as receiver or thisArg.
void GetterCallback(Local<Name> name,
auto context = info.GetIsolate()->GetCurrentContext();
info.This()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
info.Holder()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
CHECK(v8_str("r")->Equals(context, a_this).FromJust());
CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
info.GetReturnValue().Set(name);
}
templ->InstanceTemplate()->SetHandler(
LocalContext env;
env->Global()
->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked())
.FromJust();
CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");

Definition at line 11334 of file v8.h.

Friends And Related Function Documentation

◆ internal::CustomArguments< PropertyCallbackInfo >

Definition at line 4274 of file v8.h.

◆ internal::PropertyCallbackArguments

friend class internal::PropertyCallbackArguments
friend

Definition at line 4273 of file v8.h.

◆ MacroAssembler

friend class MacroAssembler
friend

Definition at line 4272 of file v8.h.

Field Documentation

◆ args_

internal::Address* args_
protected

Definition at line 4284 of file v8.h.

◆ kArgsLength

const int kArgsLength = 7
static

Definition at line 4269 of file v8.h.

◆ kDataIndex

const int kDataIndex = 5
staticprotected

Definition at line 4280 of file v8.h.

◆ kHolderIndex

const int kHolderIndex = 1
staticprotected

Definition at line 4276 of file v8.h.

◆ kIsolateIndex

const int kIsolateIndex = 2
staticprotected

Definition at line 4277 of file v8.h.

◆ kReturnValueDefaultValueIndex

const int kReturnValueDefaultValueIndex = 3
staticprotected

Definition at line 4278 of file v8.h.

◆ kReturnValueIndex

const int kReturnValueIndex = 4
staticprotected

Definition at line 4279 of file v8.h.

◆ kShouldThrowOnErrorIndex

const int kShouldThrowOnErrorIndex = 0
staticprotected

Definition at line 4275 of file v8.h.

◆ kThisIndex

const int kThisIndex = 6
staticprotected

Definition at line 4281 of file v8.h.


The documentation for this class was generated from the following file:
v8::NamedPropertyHandlerConfiguration
Definition: v8.h:6314
v8::PropertyCallbackInfo::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:11322
v8::PropertyCallbackInfo::This
V8_INLINE Local< Object > This() const
Definition: v8.h:11334
v8::FunctionTemplate::New
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
v8::FunctionTemplate::GetFunction
V8_WARN_UNUSED_RESULT MaybeLocal< Function > GetFunction(Local< Context > context)
v8::PropertyCallbackInfo
Definition: v8.h:114
v8::PropertyCallbackInfo::GetReturnValue
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:11346
v8::Local< v8::Value >
v8::FunctionTemplate::InstanceTemplate
Local< ObjectTemplate > InstanceTemplate()
v8::PropertyCallbackInfo::Holder
V8_INLINE Local< Object > Holder() const
Definition: v8.h:11340