On Tue, Apr 23, 2013 at 6:16 PM, Mike Moening <mike.moen...@gmail.com> wrote: > Why? > Because I can't find a complete example of how to do it any other way... > I need more then a two line explanation. The lack of quality documentation > and straight forward examples is outstanding.
I'm sure that the V8 team takes patches. :-) > All the examples use ObjectTemplates. The embedders guide does too. > > Also the object I'm creating has many other methods too (not just a > constructor). > I create an object template, give it a SetCallAsFunctionHandler() (so I can > create it in C++ land) then add a whole bunch of other methods using Set() > then I Set() that object template into another ObjectTemplate which used by > the Context::New() when setting up the global. > > That's my understanding of how it is supposed to work. > > Ben, I this post you were doing HasInstance() with a hack involving > SetPointerInInternalField() > https://groups.google.com/forum/#!topic/nodejs/PA3cNIZuFWU > > What that before you knew better? Heh, no. JS code can invoke a native method with a different this object (e.g. `obj.nativeMethod.call(null)`). The SetPointerInInternalField() trick checks that args.This() or args.Holder() is of the expected type. > Thanks for the help -- -- 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/groups/opt_out.