Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
v8::PropertyCallbackInfo< T > Class Template Reference

#include <v8.h>

Inheritance diagram for v8::PropertyCallbackInfo< T >:
[legend]

Public Member Functions

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

Static Public Attributes

static const int kArgsLength = 7
 

Protected Member Functions

 PropertyCallbackInfo (internal::Object **args)
 

Protected Attributes

internal::Object ** args_
 

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.

Examples
process.cc.

Constructor & Destructor Documentation

◆ PropertyCallbackInfo()

template<typename T >
v8::PropertyCallbackInfo< T >::PropertyCallbackInfo ( internal::Object **  args)
inlineprotected

Member Function Documentation

◆ Data()

template<typename T >
Local< Value > v8::PropertyCallbackInfo< T >::Data
inline
Returns
The data set in the configuration, i.e., in NamedPropertyHandlerConfiguration or IndexedPropertyHandlerConfiguration.

◆ GetIsolate()

template<typename T >
Isolate * v8::PropertyCallbackInfo< T >::GetIsolate
inline
Returns
The isolate of the property access.
Examples
process.cc.

◆ GetReturnValue()

template<typename T >
ReturnValue< T > v8::PropertyCallbackInfo< T >::GetReturnValue
inline
Returns
The return value of the callback. Can be changed by calling Set().
info.GetReturnValue().Set(...)
Examples
process.cc.

◆ Holder()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::Holder
inline
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.
Examples
process.cc.

◆ ShouldThrowOnError()

template<typename T >
bool v8::PropertyCallbackInfo< T >::ShouldThrowOnError
inline
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.

◆ This()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::This
inline
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)");
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=0, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow)
Local< Context > GetCurrentContext()
Definition: v8.h:197
Definition: v8.h:3714
Local< Object > Holder() const
Definition: v8.h:10139
ReturnValue< T > GetReturnValue() const
Definition: v8.h:10145
Local< Object > This() const
Definition: v8.h:10133
Isolate * GetIsolate() const
Definition: v8.h:10121

Friends And Related Function Documentation

◆ internal::CustomArguments< PropertyCallbackInfo >

template<typename T >
friend class internal::CustomArguments< PropertyCallbackInfo >
friend

◆ internal::PropertyCallbackArguments

template<typename T >
friend class internal::PropertyCallbackArguments
friend

◆ MacroAssembler

template<typename T >
friend class MacroAssembler
friend

Member Data Documentation

◆ args_

template<typename T >
internal::Object** v8::PropertyCallbackInfo< T >::args_
protected

◆ kArgsLength

template<typename T >
const int v8::PropertyCallbackInfo< T >::kArgsLength = 7
static

◆ kDataIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kDataIndex = 5
staticprotected

◆ kHolderIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kHolderIndex = 1
staticprotected

◆ kIsolateIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kIsolateIndex = 2
staticprotected

◆ kReturnValueDefaultValueIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kReturnValueDefaultValueIndex = 3
staticprotected

◆ kReturnValueIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kReturnValueIndex = 4
staticprotected

◆ kShouldThrowOnErrorIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kShouldThrowOnErrorIndex = 0
staticprotected

◆ kThisIndex

template<typename T >
const int v8::PropertyCallbackInfo< T >::kThisIndex = 6
staticprotected

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