I was able to achieve this by exposing some internal functionality.
Normally there's already a SetHandler method on a FunctionTemplate but it
is not available in the public API:
https://source.chromium.org/chromium/chromium/src/+/master:v8/src/objects/templates-inl.h;l=72;drc=b892cf58e162a8f66cd
Ben, yes, unfortunately the SetAccessor method doesn't allow intercepting
the setting of any arbitrary member (property or function) on the function.
On Tuesday, March 3, 2020 at 11:21:00 PM UTC+2, Ben Noordhuis wrote:
>
> On Tue, Mar 3, 2020 at 1:20 PM Darin Dimitrov > wrote:
> >
> > I tried
On Tue, Mar 3, 2020 at 1:20 PM Darin Dimitrov wrote:
>
> I tried every possible method but cannot intercept setting members on a
> Local instance. Also couldn't find any example in the
> https://chromium.googlesource.com/v8/v8/+/refs/heads/lkgr/test/cctest/test-api-interceptors.cc
>
> Is this si
I tried every possible method but cannot intercept setting members on a
Local instance. Also couldn't find any example in the
https://chromium.googlesource.com/v8/v8/+/refs/heads/lkgr/test/cctest/test-api-interceptors.cc
Is this simply not possible?
On Monday, March 2, 2020 at 11:32:50 AM UT
I managed to intercept the setting of the instance method with the
following:
myClassTemplate->PrototypeTemplate()->SetHandler(
NamedPropertyHandlerConfiguration(nullptr, [](Local property, Local<
Value> value, const PropertyCallbackInfo& info) {
printf("This will be called when setting the i