xulrunner observerService: quit-application

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

xulrunner observerService: quit-application

Wired Earp-2
It doesn't work (1.9a):

    var observerService = Components.classes [
    "@mozilla.org/observer-service;1" ].getService (
    Components.interfaces.nsIObserverService );

    var shutDownObserver = {
        observe : function () {
           alert ( "It works!" );
        }
    };
    observerService.addObserver (
        shutDownObserver,
        "quit-application",
        false );

Haven't used one of those before, but it *is* supposed to work?


--
Wired Earp
Wunderbyte
_______________________________________________
Mozilla-xpfe mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpfe
Reply | Threaded
Open this post in threaded view
|

Re: xulrunner observerService: quit-application

Justin Wood (Callek)
Wired Earp wrote:

> It doesn't work (1.9a):
>
>     var observerService = Components.classes [
>     "@mozilla.org/observer-service;1" ].getService (
>     Components.interfaces.nsIObserverService );
>
>     var shutDownObserver = {
>         observe : function () {
>            alert ( "It works!" );
>         }
>     };
>     observerService.addObserver (
>         shutDownObserver,
>         "quit-application",
>         false );
>
> Haven't used one of those before, but it *is* supposed to work?
>
>

knowing little about that all, you might want to try dump (with
appropriate activation flag set) since this seems to get fired while the
app is shutting down, making waiting on an alert to spawn a new window,
wait on an user interaction, etc impractical if not impossible.

~Justin Wood (Callek)
_______________________________________________
Mozilla-xpfe mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpfe
Reply | Threaded
Open this post in threaded view
|

Re: xulrunner observerService: quit-application

Wired Earp-2
I wrote
>> It doesn't work (nsIObserverService, "quit-application")

Callek answered:
> knowing little about that all, you might want to try dump (with
> appropriate activation flag set) since this seems to get fired while the
> app is shutting down, making waiting on an alert to spawn a new window,
> wait on an user interaction, etc impractical if not impossible.

Your're right. It does work!

Copied the alert() setup from the DevMo / XULPlannet tutorial. Read
somewhere about a "quit-application-requested" event, but even that
doesn't spawn an alert window; better leave a user comment about the
impracticality of using alerts when shutting down. Thanks!


--
Wired Earp
Wunderbyte
_______________________________________________
Mozilla-xpfe mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpfe