Hi,

i have tried out the following way

i have two np objects parent and child
and i am creating v8 objects out of them as below

v8::Handle<v8::Object> parentObject = createV8ObjectForNPObject(parent, 0);
v8::Handle<v8::Object> childObject = createV8ObjectForNPObject(child,
parent);

now when i am setting the childObject to the parent object lik
parentObject->Set(v8String(key), childObject);

and then when i execute my javascript as

parent.child.func();
it does not get executed

but if i do
v8::Handle<v8::Object> global = v8Context->Global();
 global->Set(v8String(key), childObject);

i am able to execute
child.func();

the code for createV8ObjectForNPObject basically creates a wrapper JSObject
and calls wrapNPObject(value, object);

and it calls  _NPN_RegisterObject(object, root);
so for my parent object root is 0
and for my childObject root is parent npobject


Can you please tell me where i am going wrong.


LG


On Tue, May 25, 2010 at 10:30 PM, LG <[email protected]> wrote:

> Thanks a ton for the quick reply  :)
> i will try this out..
> LG
>
>
>
> On Tue, May 25, 2010 at 10:27 PM, Seiji Sam Lee <[email protected]>wrote:
>
>> Local<ObjectTemplate> parent    =ObjectTemplate::New();
>> Local<ObjectTemplate> child     =ObjectTemplate::New();
>> Local<ObjectTemplate> grandchild=ObjectTemplate::New();
>>
>> parent->Set(JSTR("child"),child);
>> child->Set(JSTR("grandchild"),grandchild);
>> //'global' is the global ObjectTemplate
>> global->Set(JSTR("parent"),parent);
>>
>> //for example....
>> grandchild->SetCallAsFunctionHandler(callback);
>>
>> //or
>> child->Set(JSTR("grandchild"),FunctionTemplate::New(callback));
>> //with this last, grandchild template is not necessary
>>
>> //instance it and you'll have "parent.child.grandchild()"
>>
>> Get it right, I did it by memory!!
>>
>> -----Mensaje original-----
>> De: [email protected] [mailto:[email protected]] En
>> nombre
>> de LG
>> Enviado el: martes, 25 de mayo de 2010 18:48
>> Para: v8-users
>> Asunto: [v8-users] how do i achieve a a.b.c() behavior
>>
>> Hi All,
>>
>> i am new to v8
>> and i need to achieve a.b.c() behavior
>>
>> i have a parentObject, childObject and methods in childObject
>>
>> currently i am trying like this
>> parentObject->Set(v8String(key),childObject);
>>
>> can you please let me know the correct way to achieve this
>>
>> --
>> 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

Reply via email to