Yes, by quit I meant "backgrounded". Sorry for the unclear request. The page visibility API looks like what I was looking for. Thanks!
_ michael
On Tuesday, April 30, 2013 at 16:46 PM, Harald Kirschner wrote:
> Hey Michael,
>
> I recommend reacting to the
https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API and saving the state when the app goes invisible. When queries to IDB are still ongoing assume that they will not be killed when closing the app.
>
> As Kumar pointed out, the app will only be actually killed when
>
> - Its in the background and
> - the user uses the task manager to kill it or
> - app gets garbage collected when more memory is needed
> - its in the foreground and
> - has a major memory spike
>
> In all of these cases there is nothing you can do and no event.
>
> ---
> Harald Kirschner | Partner Engineer & Web Craftsman |
har...@mozilla.com (mailto:
hkirs...@mozilla.com)
>
>
> On Tuesday, April 30, 2013 at 1:23 PM, Kumar McMillan wrote:
>
> >
> > On Apr 29, 2013, at 1:24 PM,
mbi...@hitpointstudios.com (mailto:
mbi...@hitpointstudios.com) wrote:
> >
> > > Hello Everyone,
> > >
> > > I am new to this forum, but it seems like the right place to ask this question. In the utility code I'm writing, I'd like to be notified that my app is about to quit and then ask the system for some time while I dump my cache into the database (through IndexedDB).
> >
> > What do you mean exactly by quit? Here are some quit-like situations I can think of:
> > - user shuts down the phone
> > - your app is killed for using too much memory
> > - user swipes up to kill the app from the task switcher
> >
> > I don't know of a reliable way to hook into those events. Would it be possible to periodically dump the cache to the db in the background? That might be more reliable.
> >
> > >
> > > I see that there is the onunload event, but my understanding is that if I cancel that event, a dialog pops up. This is highly undesirable as I'd rather just postpone quitting (or show my own gui) until my operation is finished.
> > >
> > > Are there apis that would allow me to do this? Any suggestions?
> > >
> > > Thank you very much for your thoughts,
> > >
> > > _ michael
> > >
> > > ---
> > > Michael Bishop
> > > Hitpoint Studios, Inc.
> > > _______________________________________________
> > > dev-webapps mailing list
> > >
dev-w...@lists.mozilla.org (mailto:
dev-w...@lists.mozilla.org)
> > >
https://lists.mozilla.org/listinfo/dev-webapps
> > >
> >
> >
> > _______________________________________________
> > dev-webapps mailing list
> >
dev-w...@lists.mozilla.org (mailto:
dev-w...@lists.mozilla.org)
> >
https://lists.mozilla.org/listinfo/dev-webapps
> >
> >
> >
>
>