Thanks a lot for clarifications. Still use case looks somewhat strange to me, but probably I miss some details.
Judging from your description, map should work for you. Notice, btw, that talking about 'finding foo' is technically incorrect: there is an object (which you can find) and foo only stores a reference to it. Sorry for being pedantic. yours, anton. On Tue, Jan 26, 2010 at 4:27 AM, Ben Sparks <[email protected]> wrote: > Hmm maybe I need the map... > > What I am trying to say is: > > Say in c++ we have: > > class Point > { > ... > void someMethod(); > } > > and then I bind the constructor to v8, so in javascript I can do: > > var foo = new Point(); > var bar = new Point(); > > so then, back in c++ I want to search through the context (?) and look at > all instances of Point that are created in javascript so that I can test > each one for something so that c++ can "find" foo and then do call a > javascript method on that instance only > > thanks, > warspawn > > > On Mon, Jan 25, 2010 at 2:24 AM, Anton Muhin <[email protected]> wrote: >> >> It's hard for me to understand what exactly you're looking for, could >> you rephrase? >> >> If you're looking for the way to go from native C++ object to JS >> object (you then can invoke any method you like) typical approaches >> are 1) embedding a persistent handle into native object, 2) using a >> map mapping native objects to persistent handles. You may want to >> look how Chromium v8 bindings do that. >> >> yours, >> anton. >> >> On Sun, Jan 24, 2010 at 12:15 PM, Warspawn >> <[email protected]> wrote: >> > Say I have a class instanced in javascript, with an internal field >> > holding the c++ pointer, is there a way I can use the c++ pointer to >> > find and execute a script function on that instance? Can I search >> > through the context for all functions and test if they are an instance >> > of a particular function template and then maybe test those objects to >> > see if they are holding the pointer in question? >> > >> > -- >> > v8-users mailing list >> > [email protected] >> > http://groups.google.com/group/v8-users >> > >> >> -- >> v8-users mailing list >> [email protected] >> http://groups.google.com/group/v8-users > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
