Re: Notifications

On Wed, Feb 3, 2010 at 1:22 PM, Anne van Kesteren <annevk@opera.com> wrote:

> On Wed, 03 Feb 2010 18:55:32 +0100, Olli Pettay <Olli.Pettay@helsinki.fi>
> wrote:
>
>> some random comments about
>> http://dev.w3.org/2006/webapi/WebNotifications/publish/
>> (I didn't know that the draft existed until the link was mentioned
>>  in an email to @whatwg mailing list :/ )
>>
>
> Some other thoughts on this API:
>
> * It would be nice if we could avoid the exception somehow. Maybe just have
> an error callback?
>

I'm neutral on that.  If the preferred convention is to use an error
callback instead of an exception, Web Notifications should do the same.

* I'm not a big fan of introducing two new ways to load resources as
> proposed in this API. We are not doing that elsewhere either (consider e.g.
> drawImage()). Passing a Document and HTMLImageElement (potentially
> HTMLCanvasElement and HTMLVideoElement too I suppose) would make more sense.
> This does create some additional burden on the developer but it does keep
> security-sensitive operations more limited and also gives the ability for
> greater control and information. (E.g. with XMLHttpRequest you get to know
> how fast the resource is being fetched, etc.) Libraries could provide the
> higher-level API.
>

Having the site construct the Document seems like it adds a lot of
complexity for the developer.  Another concern is that the notification
resources don't need to be loaded immediately in the case of a queue. If a
notification is queued and then canceled before being displayed, that
resource load can be avoided.

* If we keep checkPermission() it should not be a method. But I'm not sure
> it is needed if there is an error callback.


Yes, this makes sense; I am changing the draft spec to have a
permissionLevel attribute.  I think having access to the permission level is
important for the same reasons as Drew gave: the site should know whether to
display permissions UI in advance of having a notification to show.

 -John

Received on Wednesday, 3 February 2010 22:41:00 UTC