- From: James Graham <jgraham@opera.com>
- Date: Fri, 15 Oct 2010 13:09:36 +0200
- To: Web Notification WG <public-web-notification@w3.org>
I wonder what the reason for the NotificationCenter design is. Does
having a createNotification factory function buy us anything over just
having a constructor so we can do something like
var notification = new Notification(iconUrl, title, body)
It seems to me that this design would be more consistent with XHR, which
seems closer in function to the notifications API than createElement and
friends from DOM Core.
Having a function would make sense if the API instead queued the
notification to be shown as soon as possible (note, I am not actually
advocating this) however it is hard to see a reasonable design that
would allow event handlers to be attached in such a design unless one
did something like:
showNotification(iconUrl, title, body, handlers)
Where handlers was an object like {onclick:function(){}} and so on. But
this kind of design is without precedent in the DOM.
On a somewhat unrelated note, it is not really clear to me what the use
case of the cancel method is. I suspect that there are use cases, but
the example in the draft of displaying a notification for at most 15s (I
assume platforms can hide the notification at any time they like)
doesn't seem that well motivated. If we expect that specific case to be
common we should consider adding an explicit timeout to the API.
Otherwise a different example might be helpful.
Speaking of examples, there is a createWebNotification example in
section 7 of the "Web Notifications" document. This should be changed to
a createNotification example or moved to the other document.
Received on Friday, 15 October 2010 11:10:14 UTC