Re: [whatwg] Notifications and service workers

On Fri, Sep 26, 2014 at 6:23 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> 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.

I'm not sure I understand what you are saying here. The above code is
the creation steps, not the notification steps.

I agree that the "click" event needs to expose the Notification
object. But the SW "click" event needs to be fired at the SW global,
and have as one of its properties the Notification object. Exactly
because the SW might have been killed previously and is just getting
spawned in order to fire the "click" event. Thus no other references
to the Notification object might exist.

/ Jonas

Received on Friday, 26 September 2014 13:32:14 UTC