Contact emailsSpec"If options's vibrate is present, validate and normalize it and set notification’s vibration pattern to the return value."SummaryThe "vibrate" flag as part of Notification options, which allows authors to supply a vibration pattern similar to "navigator.vibrate()", which is to be applied when a Notification gets shown.
For example:serviceWorkerRegistration.showNotification('Title', {body: 'message',vibrate: [100, 200, 300]});Introducing the "vibrate" attribute is blocked on the following bug.But we would much prefer to have the attribute introduced to the specification prior to us shipping this.
Hi Sanghyun Park,Thank you for implementing this! It'll make a great addition for Web Notifications on Android, as developers not rarely use a vibration pattern to allow users to quickly, audibly identify the source of the notification.On Fri, May 22, 2015 at 2:08 PM, Sanghyun Park <sh919...@samsung.com> wrote:Contact emailsSpec"If options's vibrate is present, validate and normalize it and set notification’s vibration pattern to the return value."SummaryThe "vibrate" flag as part of Notification options, which allows authors to supply a vibration pattern similar to "navigator.vibrate()", which is to be applied when a Notification gets shown.Not just similar, but following exactly the same syntax, sanitation and limitations.
For example:serviceWorkerRegistration.showNotification('Title', {body: 'message',vibrate: [100, 200, 300]});Introducing the "vibrate" attribute is blocked on the following bug.But we would much prefer to have the attribute introduced to the specification prior to us shipping this.To clarify, are you requesting permission to ship the dictionary option but *not* the attribute, since we implement both?It would be great if you could file an issue against the Notification spec (capturing what the specification already mentions) for introducing the attribute. I'd prefer to ship both at the same time if we can :-)
[+annevk, heycam] I don’t think fixing this will be as easy as you might hope. Good old bug 23682 has a long history, and nobody’s buckled down to solve it yet.
We could try to get the notifications spec patched with a one-off fix, but that doesn’t seem great. And even if we did, implementing it would require custom bindings---the current implementation in Blink returns a new array every time, which is exactly what we want to avoid by solving bug 23682. It’d be better to solve bug 23682 at the spec level, which will result in new Web IDL syntax which we then implement bindings for, which would make the actual implementation of the vibrate attribute much simpler.
So I don’t think it’s a great idea to block shipping vibrate functionality on exposing the vibrate attribute.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
[+annevk, heycam] I don’t think fixing this will be as easy as you might hope. Good old bug 23682 has a long history, and nobody’s buckled down to solve it yet.
We could try to get the notifications spec patched with a one-off fix, but that doesn’t seem great. And even if we did, implementing it would require custom bindings---the current implementation in Blink returns a new array every time, which is exactly what we want to avoid by solving bug 23682. It’d be better to solve bug 23682 at the spec level, which will result in new Web IDL syntax which we then implement bindings for, which would make the actual implementation of the vibrate attribute much simpler.
So I don’t think it’s a great idea to block shipping vibrate functionality on exposing the vibrate attribute.
The WebIDL syntax used is "readonly attribute sequence<unsigned long>?
Is it the question of whether the same object should be returned every time?
On Tue, May 26, 2015 at 9:53 AM, Cameron McCormack <c...@mcc.id.au> wrote:
> Anne van Kesteren:
>> > It should be the same object. One array per Notification object that is.
>> > Depending on the outcome of the IDL bug it might need to be a frozen array.
>
> Philip Jägenstedt:
>> Should it also be the same object as is passed to new Notification('',
>> { vibrate: [100] })? If it's frozen, should that object be frozen by
>> the constructor?
>
> No, I was planning on making it a separate, newly created and frozen
> array. You’d convert the [100] JS value as if you were passing it
> something expecting a sequence<T>, and then you’d make a new Array
> object with the right values, and then freeze it.
Thanks, I've taken a look and it all looks pretty straightforward:>> Cameron, do you know what needs to be done to move bug 23682 along for
>> the specific case of a readonly attribute sequence<T>?
>
> The syntax I’ve got in my branch is FrozenArray<T>. So you’d still be
> prohibited from writing |readonly attribute sequence<T>|.
>
> I think we exhausted the discussion around the different ways to handle
> properties with array-ish values. The next step is for me to unbitrot
> that branch and merge it in. (It’s the “arrays” branch of
> https://github.com/heycam/webidl/ if you want to have a look before I do
> that.)
convert to an Array and freeze it. Whether or not that's the right
model for Notification.vibrate I think is mostly a question for Anne
and Peter, but it sounds OK to me.
If that spec change is made in WebIDL and the Notification spec,
shipping Notification.vibrate would be blocked on implementing
FrozenArray<T>.
On Tue, May 26, 2015 at 9:57 AM, Philip Jägenstedt <phi...@opera.com> wrote:On Tue, May 26, 2015 at 9:53 AM, Cameron McCormack <c...@mcc.id.au> wrote:
> Anne van Kesteren:
>> > It should be the same object. One array per Notification object that is.
>> > Depending on the outcome of the IDL bug it might need to be a frozen array.
>
> Philip Jägenstedt:
>> Should it also be the same object as is passed to new Notification('',
>> { vibrate: [100] })? If it's frozen, should that object be frozen by
>> the constructor?
>
> No, I was planning on making it a separate, newly created and frozen
> array. You’d convert the [100] JS value as if you were passing it
> something expecting a sequence<T>, and then you’d make a new Array
> object with the right values, and then freeze it.Additionally, specific to this case, the vibration pattern will be normalized before it's set on the Notification object, so passing [100, 10] in the NotificationOptions dictionary would result in Notification.vibrate to be [100].
>> Cameron, do you know what needs to be done to move bug 23682 along for
>> the specific case of a readonly attribute sequence<T>?
>
> The syntax I’ve got in my branch is FrozenArray<T>. So you’d still be
> prohibited from writing |readonly attribute sequence<T>|.
>
Thanks, I've taken a look and it all looks pretty straightforward:> I think we exhausted the discussion around the different ways to handle
> properties with array-ish values. The next step is for me to unbitrot
> that branch and merge it in. (It’s the “arrays” branch of
> https://github.com/heycam/webidl/ if you want to have a look before I do
> that.)
convert to an Array and freeze it. Whether or not that's the right
model for Notification.vibrate I think is mostly a question for Anne
and Peter, but it sounds OK to me.The Notification object, aside from the event listeners, is already immutable so that seems fine to me. I'll leave the IDL and array specifics to Anne and Cameron.
If that spec change is made in WebIDL and the Notification spec,
shipping Notification.vibrate would be blocked on implementing
FrozenArray<T>.That raises the question whether we should rescope this Intent to Ship to shipping NotificationOptions.vibrate and not Notification.vibrate, or block shipping the feature on the FrozenArray<T> work.I'm on the fence - this is not a high priority feature and we can hold off without much harm, but it does provide nice UX benefits when used on Android and it would be nice to get it out there. Perhaps we should postpone the decision to when we also support author-defined sounds and the renotify property, in order to provide a more holistic package in regards to gaining the user's attention?I'd also like to hear from Sanghyun Park what his opinion is, since he implemented it.
Thanks,Peter
Anne, could you tell me why we should use "Sameobject" about this?
On Wednesday, May 27, 2015, Sanghyun Park <sh919...@samsung.com> wrote:Anne, could you tell me why we should use "Sameobject" about this?It should not be the same object that is passed in. That one is normalized per IDL sequence semantics. However, for properties we want to preserve obj.property === obj.property. Returning fresh objects from the getter would destroy that invariant.
I have no strong opinions on frozen. I think I would rather use an actual immutable array, but that doesn't exist.
--
https://annevankesteren.nl/