would you please help me how to use js code in "
http://forums.mozillazine.org/viewtopic.php?p=1694347#1694347";

first i generate guid then i put js code in components folder of my
extension, then what :))

*asqueella* said:
Either put the .js file with this code in Firefox/components or in your XPI
file and install it. Delete compreg.dat to be safe, and it should get
registered.

what does either main here ? am i need to create xpt file too ?

On Nov 15, 2007 1:01 PM, Michael Vincent van Rantwijk, MultiZilla <
[EMAIL PROTECTED]> wrote:

> Nickolay Ponomarev wrote:
> > On Nov 15, 2007 11:06 AM, Michael Vincent van Rantwijk, MultiZilla
> > <[EMAIL PROTECTED]> wrote:
> >>> //register Observer
> >>> window.addEventListener("load", MyObserver, false);
> >>> function MyObserver(){
> >>> var observerService = Components.classes["@
> mozilla.org/observer-service;1"]
> >>>         .getService(Components.interfaces.nsIObserverService);
> >> Don't do that here, but outside the observer; because it will 'run' for
> >> all loads!
> >>
> > Huh?
>
> This is two fold as moving "var observerService" out of the observer
> scope, makes the observer a few ms faster, and there is probably no need
> to add a new observer for each time the load event is triggered.
>
> >>>    1. how can i find that observer is registered before or not ?
> >> Have you looked at enumerateObservers in nsIObserverService.idlalready?
> >>
> > Oops. Still you shouldn't use it, at least in your case. (I question
> > the kosherness of its in-tree uses).
>
> Choice is something good in my books, and it is an option, but I would
> rather use the other tip (see link) myself.
>
> >>>    2. when i register observer only when first window opens every
> thing
> >>>    is ok, when i open some other windows still every thing is ok and
> observer
> >>>    works perfectly, but when i close first window while other windows
> are still
> >>>    open the observer doesn't work anymore ?!
> >> There is a hidden window which you can use, or better use a
> (JavaScript)
> >> component to store your global vars and observers, which makes
> listening
> >> for opening and closing of (browser) windows also a lot easier.
> >>
> > Can we stop suggesting people use the hidden window? It's an
> > implementation detail really, not to be used by extensions.
>
> Well well... do we make progress ;)
>
> --
> Michael Vincent van Rantwijk
> - MultiZilla Project Team Lead
> - XUL Boot Camp Staff member (ActiveState Training Partner)
> - iPhone Application Developer
>
> _______________________________________________
> 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

Reply via email to