On 5 Mar 2015 5:49 pm, "Elliott Sprehn" <esp...@chromium.org> wrote:
>
> Should it be getAll() to match other APIs?
Yeah, I think it should be. "get()" is confusing because of JS getter syntax.
> To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
On Sat, 7 Mar 2015, at 19:34, Peter Beverloo wrote:
> Thank you for your feedback, Mounir!
>
> Notification.data is only meant for storing small amounts of data: the
> URL
> to open when the notification was clicked on, the id of an e-mail thread,
> and perhaps a structure for the more advanced web apps.
If it's meant for small amount of data, I think the specification should
define a strict limit to prevent browser specific behaviour that will
break interop.
> Because the lifetime of the notification is largely out of the
> developer's
> hands - it's user visible UI which can be dismissed at any time (with no
> close event!), it's neither convenient nor appropriate for storing
> anything
> other than such information. It's unreliable.
Arguably, your proposal gives the solution to that: getNotifications()
should solve this problem by allowing developers to keep track of which
Notifications they have running at any time. Though, I agree that this
is not ideal and a real problem.
> One important thing to consider is that the learning curve for using
> persistent notifications (and Push) already is very high. This is
> workable
> for the large Web apps of the world, but it poses a significant entry
> barrier for the vast long-tail of developers. For them, there is unlikely
> to be an application database at all. They just want to show a
> notification
> which opens a URL.
>
> Adding yet another requirement, IndexedDB, on top of an existing, long
> list
> of requirements for a very common use-case does not sound reasonable to
> me.
> We want to optimize for the common case, not complicate it further.
Using a storage mechanism can be reduced to something like:
```js
storage.get(my_id).then(function(data) {});
storage.set(my_id, data);
```
I do not think it is fair to say that a developer willing to use Push
Notifications with a Service Worker can't take the burden of using raw
IDB or a library on top of it.
> I encourage you to file an issue against the Notification API
> specification
> if you feel this is worth pursuing further.
> https://github.com/whatwg/notifications/issues
>
> Implementation wise, I agree that we should impose some reasonable limit
> to
> prevent abuse, which we'll definitely think about.
https://github.com/whatwg/notifications/issues/39
Note that if we go with Notification.data the limit should be set by the
specification and not be implementation specific.
-- Mounir
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
Thank you for your feedback, Mounir!Notification.data is only meant for storing small amounts of data: the URL to open when the notification was clicked on, the id of an e-mail thread, and perhaps a structure for the more advanced web apps.
Because the lifetime of the notification is largely out of the developer's hands - it's user visible UI which can be dismissed at any time (with no close event!), it's neither convenient nor appropriate for storing anything other than such information. It's unreliable.
On Sat, Mar 7, 2015 at 11:34 AM, Peter Beverloo <pe...@chromium.org> wrote:Thank you for your feedback, Mounir!Notification.data is only meant for storing small amounts of data: the URL to open when the notification was clicked on, the id of an e-mail thread, and perhaps a structure for the more advanced web apps.I agree this is not onerous.Because the lifetime of the notification is largely out of the developer's hands - it's user visible UI which can be dismissed at any time (with no close event!), it's neither convenient nor appropriate for storing anything other than such information. It's unreliable.This seems like an important point and one we can make clearer, e.g., by outlining the expected behavior across UA restarts. E.g., if Chrome is closed, what happens to the notification? To the .data property?
Hi Peter,
ServiceWorkerRegistration.getNotifications() and Notification.data
both sound like good additions!
It seems to me that the storage problem of Notification.data would be
the same if it were a string, with the difference that it would be
easier to specify a size limit to a string. Giving each Notification
an implementation-provided unique ID that an app can use to associate
data in some other storage would of course work, but that seems very
annoying for the 99% of cases where the app only wants to store a
short string.
It looks like you can also store an arbitrary amount of data in e.g.
Notification.sound, which is even reasonable if it's a data URI of a
sound.
Peter, are you intending to have any size limits in the implementation
that *could* be standardized? If the issue could be avoided entirely
that would be nice...
Philip
Hi Peter,
ServiceWorkerRegistration.getNotifications() and Notification.data
both sound like good additions!
It seems to me that the storage problem of Notification.data would be
the same if it were a string, with the difference that it would be
easier to specify a size limit to a string. Giving each Notification
an implementation-provided unique ID that an app can use to associate
data in some other storage would of course work, but that seems very
annoying for the 99% of cases where the app only wants to store a
short string.
It looks like you can also store an arbitrary amount of data in e.g.
Notification.sound, which is even reasonable if it's a data URI of a
sound.
Peter, are you intending to have any size limits in the implementation
that *could* be standardized? If the issue could be avoided entirely
that would be nice...
A related question: is there any advantage doing the serialization in the platform over just making data a string with a relatively high size limit thus allowing developers to json format an arbitrary (but not "too" big) object graph? Of course the spec has to change for this as now it says the type of data is 'any'. I suppose it would much straightforward to define the limit in terms of a string length.Balazs
On Wed, Mar 11, 2015 at 4:14 AM, Philip Jägenstedt <phi...@opera.com> wrote:Hi Peter,
ServiceWorkerRegistration.getNotifications() and Notification.data
both sound like good additions!
It seems to me that the storage problem of Notification.data would be
the same if it were a string, with the difference that it would be
easier to specify a size limit to a string. Giving each Notification
an implementation-provided unique ID that an app can use to associate
data in some other storage would of course work, but that seems very
annoying for the 99% of cases where the app only wants to store a
short string.
It looks like you can also store an arbitrary amount of data in e.g.
Notification.sound, which is even reasonable if it's a data URI of a
sound.We've already seen developers store bits of data in the hash part of the icon URL :-(.Peter, are you intending to have any size limits in the implementation
that *could* be standardized? If the issue could be avoided entirely
that would be nice...Yes, I do intend to have a limit, but I have not yet decided what a reasonable limit would be. The purpose of this limit would be to avoid abuse, for which UMA counters will be added.I suggested adding a limit to the specification, but it's not great to just define an arbitrary limit for no reason. I think it's more valuable for now for the specification to suggest appropriate uses, and decide on specifying a limit when UMA data can back up this decision.