Well, I don't care for it, but this works:

auto ft2 = v8::FunctionTemplate::New(i);
> auto gftp = new Global<FunctionTemplate>(i,ft);
> ft2->SetCallHandler(do_something, v8::External::New(i,gftp));
> ft->InstanceTemplate()->Set(i, "do_something", ft2);



On Tuesday, February 16, 2016 at 6:40:28 AM UTC-8, Zac Hansen wrote:
>
> I'm feeling rather silly, but how do you get the function template into 
> the callback to check against?  It's not a v8::Value, so you can't pass it 
> in as data.  
>
> Do I put a Global<FunctionTemplate> on the heap and pass it in as an 
> External in the data field of the callback?   
>
> You have to register the callback and data for it while creating the 
> callback.
>
> On Tuesday, February 16, 2016 at 6:26:51 AM UTC-8, Ben Noordhuis wrote:
>>
>> On Tue, Feb 16, 2016 at 3:00 PM, Zac Hansen <[email protected]> wrote: 
>> > So I decided to check the prototype of the object I'm getting from 
>> Holder, 
>> > and lo and behold, there's my object.   But now the question remains, 
>> how am 
>> > I supposed to figure out how far down the prototype chain I need to go? 
>> > 
>> > Updated code including link to line where I don't know what I'm 
>> supposed to 
>> > do: 
>> > 
>> > 
>> https://gist.github.com/xaxxon/e0add46f332ab2e2b39c#file-updated-cpp-L34 
>> > 
>> > --Zac 
>>
>> Local<FunctionTemplate> function_template = /* ... */; 
>> Local<Object> instance = 
>>     args.Holder()->FindInstanceInPrototypeChain(function_template); 
>> if (instance.IsEmpty()) return; 
>> void* pointer = instance->GetAlignedPointerFromInternalField(0); 
>>
>

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to