Re: Feedback from Safari on Web Notifications

On Mar 13, 2012, at 10:51 AM, Edward O'Connor <eoconnor@apple.com> wrote:

> Jon Lee wrote:
> 
>> 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.
> 
> What Anne means is, if the constructor doesn't directly show but instead
> queues a task to show, the task that called the constructor will run to
> completion before the show task happens. So listeners attached with
> addEventListener will work. For instance,
> 
> var n = new Notification("title", "body");
> n.addEventListener("show", function(whatever) { blah; });
> 
> Both of these lines of code happen in one task, and showing the
> notification happens in another task (after this run of the event loop
> completes).

I see; I didn't understand the notion of task. Ojan's original proposal included "onclick". Anne, are you arguing that we shouldn't include the event listeners in the options, and only allow them to be set after the constructor?

Do others agree with this? Or is the fact that showing is a queued task somehow implied already elsewhere in the spec? I'm just beginning to familiarize myself with spec-ese terms.

Jon

Received on Tuesday, 13 March 2012 20:21:39 UTC