notifications
notifications copied to clipboard
Multiple icon definitions
I think the initial patch has the general shape of what I want to do for #28.
I did find there's two ways we could go with the attribute getters on a notification, for example for the icon. To me it's not clear whether we need a single icon getter that reflects the selected url, or both icon and icons which reflect the exact input from options.
Previously icon reflected a serialization of the options icon input that was parsed with baseURL, not the exact original input. That means, for example, that if parsing fails, the getter returns the empty string. The implications for NotificationIcon are not clear to me: would invalid input such as for type or sizes need to be dropped in the same way? That might surprise developers.
I think it would be nicer if icon/badge simply reflected the selected URL.
(And we'd do away with icons/badges.)
Thanks Anne, I've cleaned it up a bit as discussed. Of note:
- Just return the selected URL, do not expose getters for the multiple inputs.
- As input and output are now more obviously asymmetrical (the missing getters on the output) I had to split NotificationAction into a NotificationActionOptions dictionary and a NotificationAction interface.
- Afaict using an interface with readonly attributes for the output has the happy side effect of not needing to explicitly freeze the action, so I deleted that wrinkle.
This looks pretty good I think. Who else should we ask for review?
CC @beverloo @foolip @mounirlamouri @xxyzzzq in case there's something really crazy in here. If necessary we can probably align a detail or two as needed in a followup change.
I'll aim to land this Friday (maybe ping me during the day just in case) unless someone has major concerns.
There's definitely some similarity here with https://github.com/whatwg/mediasession/pull/129
Feedback on that PR appreciated, and is there a good place to put the common bits? Looks to me at first glace like the whole "list of images" concept that uses the [{src:'foo'}] syntax can and should be shared.
Closing this due to lack of activity. If there's still interest let's discuss in #28.