As in :
http://developer.mozilla.org/en/docs/wrappedJSObject,
when i use this code:
http://forums.mozillazine.org/viewtopic.php?p=1694347#1694347
var myService = Components.classes["@mozilla.doslash.org/test/component;1
"].getService();
myService.QueryInterface(Components.interfaces.*nsIObserver*);
dump(myService.observe)
it works perfectly and output is "function observe() { [native code] }"
but when i add some variable to code like:
MyComponent.prototype = {
...
MyVar:'hello',
....
}
then when i use above code again it works but the below code does not work
dump(myService.MyVar) >> undefined
maybe this problem cause because *nsIObserver ?*
On Nov 20, 2007 7:54 PM, Eric H. Jung <[EMAIL PROTECTED]> wrote:
>
> --- joe ertaba <[EMAIL PROTECTED]> wrote:
> > in
> >
> > MyComponent.prototype = {
> > ...
> > MyVar:'hello',
> > ....
> > }
> >
> > how can access it from my extension
> > i want to write/read it as a global variable
>
> Use the wrappedJS trick (search MDC for info). You'll be able to do this
> from your extension:
>
> var myService = Component.classes["@joeertaba.org/myext/service;1
> "].getService().wrappedJSObject;
> myService.hello = "world!";
>
> _______________________________________________
> Project_owners mailing list
> [email protected]
> https://www.mozdev.org/mailman/listinfo/project_owners
>
_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners