views:

39

answers:

1

I have an extension with a sidebar, when the user close the sidebar a method is called. I need to diference when the user close the sidebar than when he closes the browser.

pseudo code:

if (userClosedBrowser){
 //do something
}else if(userClosedSidebar){
 //do something else
}
A: 

You can listen for the "quit-application" observer topic. Or, if you want to be able to stop the quit, you can listen for "quit-application-requested".

sdwilsh
That's what I need, can you give me an example of it? because on MDC I can't understand it at all.
Agustin
Basically, you need to add an observer like this (http://mxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/src/nsLoginManagerPrompter.js#55), and then add a method called observe like this (http://mxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/src/nsLoginManagerPrompter.js#69). This page (https://developer.mozilla.org/en/XUL_School/Observer_Notifications) on MDC should give a good explanation.
sdwilsh