On Sun, Apr 7, 2019 at 1:43 AM Al Mo <almos...@gmail.com> wrote:
> I'm new here so first of all: Hi Everyone :D
>
> So, let's say I make a function this way:
>
> v8::Function::New(<Isolate>, <C_Function>, <Data_Value>);
>
>
> I can then get the <Data_Value> when the Function is invoked with something 
> like: FunctionCallbackInfo->GetData().
>
> This is useful for many things. I'm looking for a way to be able to inspect 
> this data value for a previously defined Function object. Something like 
> Function->GetData(), you get the idea.
>
> So far I haven't succeeded and I've read the docs from a to z. Any ideas?

There is no such function or method at the moment. You could open a CL
(a code change) that adds it. See https://v8.dev/docs/contribute for
details on the process.

In case it helps, the path to get from a v8::Function to the `data`
property is this (I think):

1. Convert the v8::Function to a JSFunction
(`i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this))` where
`this` is the v8::Function, see src/api.cc)

2. Get the SharedFunctionInfo, function->shared()

3. Get the FunctionTemplateInfo, shared->get_api_func_data() when
shared->IsApiFunction() is true

4. Get the CallHandlerInfo, function_template_info->call_code()

5. call_handler_info->data()

Hope that helps!

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to