W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2014

Re: [whatwg] Notifications and service workers

From: Anne van Kesteren <annevk@annevk.nl>
Date: Fri, 26 Sep 2014 15:23:56 +0200
Message-ID: <CADnb78iw-ypo55s2CPH+2BZNU0r3ow7esR_Dk62NFxHkh-EDnw@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: WHATWG <whatwg@whatwg.org>, Jake Archibald <jaffathecake@gmail.com>, Peter Beverloo <beverloo@google.com>
On Fri, Sep 26, 2014 at 12:48 AM, Jonas Sicking <jonas@sicking.cc> wrote:
> Or, should persistent notifications not use a constructor at all?
> What's the purpose of having a reference to a Notification object if
> no events will ever fire on it? Maybe we should have a function like
> promise = createPersistentNotification(...);
> promise.then(notificationWasShown, notificationWasRejected);

Well presumably we still want to share an object of sorts as part of
the event, so all the notification data is exposed somehow. A promise
does not make much sense to me as a service worker can be killed at
any point. new Notification("...", {serviceWorker:...}) still makes
the most sense. You create a new notification and by assocation with a
service worker you extend its lifetime.

> If we tie non-persistent notifications to the lifetime of a global,
> then I don't know that it makes sense to allow them to be created from
> a worker.

Dedicated workers are tied to the lifetime of a global. And shared
workers are tied to the lifetime of the union of their associated
globals. The point is mostly that they will be removed from the
notification center at some point.

Received on Friday, 26 September 2014 13:24:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:23 UTC