Re: [whatwg] Notifications and service workers

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.


-- 
https://annevankesteren.nl/

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