[Project_owners] Global listeer

Nickolay Ponomarev asqueella at gmail.com
Wed Nov 21 03:10:53 PST 2007

On Nov 21, 2007 9:38 AM, joe ertaba <belaviyo at gmail.com> wrote:
> As in :
>           http://developer.mozilla.org/en/docs/wrappedJSObject

You didn't post any of the wrappedJSObject-related code from that
page. I hoped that page was pretty clear, but if you can suggest
improvements, please do.

> myService.QueryInterface(Components.interfaces. nsIObserver);
> dump(myService.observe)
> it works perfectly and output is " function observe() { [native code] }"
..which is defined in the nsIObserver interface, so is known to the
XPConnect wrapper you have in myService. The JS object properties that
are not part of any interface the wrapper knows about are not visible
to your code working with the wrapper.

> but when i add some variable to code like:
> MyComponent.prototype = {
> ...
> MyVar:'hello',

BTW, I would instead define the var in the MyComponent constructor,
it's probably closer to what you need:

function MyComponent() { this.myVar = "hello"; }


More information about the Project_owners mailing list