Thanks, this is what I'm looking for.

All that I need to do is to pass in a Javascript object instead of a {
}, And have a wrappedJSObject property that returns the reference to the
object (this).

Thanks.

Regards,
    Kok Hoor

-----Original Message-----
From: John Bandhauer [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 10, 2002 12:49 AM
To: [EMAIL PROTECTED]
Subject: Re: Converting an object back from nsISupports to Javascript
Object or Array ( { } or [ ] )


David Bradley wrote:
> Kok Hoor , SolutionX wrote:
> 
>> Hi,
>>
>>     I am only getting an nsISupports as the subject when the
>> observers receive the notification. My question is, how should I 
>> QueryInterface on the subject to retrieve either a:
>>
>>     1. Javascript object
>>     2. Javascript array
>>     
> 
> 
> If I understand you correctly, you'll need to QI to 
> nsIXPConnectJSObjectHolder and then access the JSObject property via 
> GetJSObject. That will give you a JSObject*. Are you looking for 
> JSObject pointer?

It sounds to me like the goal is to do this from JS code rather 
than native code. If that is the case then the 'wrappedJSObject' 
scheme is the appropriate solution.

Read closely the rambling comment at:
http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/idl/nsIXPConnec
t.idl#225

And look at a couple of examples in .js and .html files here:
http://lxr.mozilla.org/seamonkey/search?string=wrappedJSObject

John.

> 
> David
> 



Reply via email to