W3C home > Mailing lists > Public > public-web-notification@w3.org > March 2012

Re: Feedback from Safari on Web Notifications

From: Jon Lee <jonlee@apple.com>
Date: Tue, 13 Mar 2012 10:28:54 -0700
Cc: James Graham <jgraham@opera.com>, Ojan Vafai <ojan@chromium.org>, John Gregg <johnnyg@google.com>, Maciej Stachowiak <mjs@apple.com>, public-web-notification@w3.org, Ted O'Connor <eoconnor@apple.com>
Message-id: <4B54137D-DF7C-4971-A274-068CFE10BE4D@apple.com>
To: Anne van Kesteren <annevk@opera.com>

On Mar 13, 2012, at 1:44 AM, Anne van Kesteren wrote:

> On Tue, 13 Mar 2012 01:32:18 +0100, Jon Lee <jonlee@apple.com> wrote:
>> So by having the event listeners as part of the options dictionary, would it make sense, then, to remove the assignable attributes? Therefore, the only way to modify the listeners is through add/removeEventListener()?
> If we make the constructor queue a task, you could still assign event listeners in the same task that created the constructor.
I don't quite understand what this means. If the constructor creates the Notification and also queues/presents the notification, then why would anyone want to re-assign listeners? The code already has an opportunity to set all the listeners in the options dictionary. By the time the constructor is finished, the notification is already shown, so trying to change onshow doesn't do anything useful. Same with onerror, since that only gets called if the notification could not be shown. I suppose one might want to do it for the other handlers, but I don't think there's any extra information that you gain once the constructor is executed that might require you to alter the listener you already added.

Another question. Take this code:

function a() {}
function b() {}
var n = new Notification('title', 'body', {onshow:a, onclose:b});

Does the options object then equate to something like:
n.onshow = a;

n.addEventListener('show', a, false);

Received on Tuesday, 13 March 2012 17:30:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:13 UTC