Re: Auto closing of notifications

On Wed, Oct 23, 2013 at 9:23 AM, Jasper St. Pierre
<jstpierre@mecheye.net> wrote:
> I wonder if something similar could be done in the web world; instead of
> using live callbacks, have the user agent navigate to a specific URL in the
> originating tab / a new tab, which the web app could detect and do things
> on?

There is a concept of this for firefoxos web apps. They can listen for
navigator.mozSetMessageHandler('notification'…[1] to get a handle on
the notification data that triggered the app start. The app can use
navigator.mozHasPendingMessage('notification')[2] to know if the app
should wait for the mozSetMessageHandler callback before completing
its startup.

This is useful since it is common for firefoxos web apps to get purged
from memory for out of memory constraints. Which is also a use case
that would argue for not automatically closing notifications on
app/tab kill.

Longer term, I would be interested in using a 'POST' type of request
for notifications to a Service Worker[3] as a way to streamline the
app startup process. More info on that service controller pathway in a
dev-gaia post[4] (although assumes some other context, see "Possible
uses for Service Workers" section for direct info).

This is now starting to stray too much from the original post about
auto-closing, so I will stop here.

[1] https://developer.mozilla.org/en-US/docs/Web/API/window.navigator.mozSetMessageHandler
[2] https://developer.mozilla.org/en-US/docs/Web/API/window.navigator.mozHasPendingMessage
[3] https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
[4] https://groups.google.com/d/msg/mozilla.dev.gaia/NTG1nzGYcn0/Fu_u61PW83UJ

James

Received on Thursday, 24 October 2013 00:37:57 UTC