ok!
My code is:
//register Observer
window.addEventListener("load", MyObserver, false);
function MyObserver(){
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
// problem1: observer registered before or not ??
observerService.addObserver(ObserverFunction, "my-topic", false);
//i dont add anything to remove observer when window going to close
}
var ObserverFunction= {
observe: function (subject, topic, state) {
.....
}
}
i have to problems:
1. how can i find that observer is registered before or not ?
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 ?!
On Nov 15, 2007 10:34 AM, Nickolay Ponomarev <[EMAIL PROTECTED]> wrote:
> On Nov 15, 2007 12:39 AM, joe ertaba <[EMAIL PROTECTED]> wrote:
> > hi Nickolay
> >
> > i have registered an observer , now my problem is how to find out :
> > am i already register this observer or not when user open a new window,
> >
> > in my extension observer registered when user open new window
> >
> >
> You give too few details. How about you tell what you're trying to do,
> then show the relevant snippets of code?
>
> Nickolay
>
> >
> >
> > On Nov 14, 2007 1:13 PM, Nickolay Ponomarev <[EMAIL PROTECTED]> wrote:
> > > On Nov 13, 2007 10:59 PM, joe ertaba < [EMAIL PROTECTED]> wrote:
> > > > i need to add a listener to my extension, the listener must be
> global,
> > > > it must support all windows together? is it possible to do this with
> > > > one listener
> > > >
> > > What kind of listener? Some 'listeners' (such as global observers
> > > registered via nsIObserverService) are not window-dependent and can be
> > > registered globally from an XPCOM component.
> > >
> > > Nickolay
> >
> > > _______________________________________________
> > > 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
> >
> >
> _______________________________________________
> 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