W3C home > Mailing lists > Public > public-device-apis@w3.org > October 2013

Vibration API: clamp argument

From: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Date: Tue, 22 Oct 2013 12:23:40 +0100
Message-ID: <CAF40kP7m8xqevT5JSodxJu5cEMX6ry1EMu8tvkx6g4K9DYRn6w@mail.gmail.com>
To: "<public-device-apis@w3.org>" <public-device-apis@w3.org>
Hi, would it make sense to add the [Clamp] attribute to the argument of the
vibrate method? This would be added in WebIDL.

See the Clamp attribute here:
http://dev.w3.org/2006/webapi/WebIDL/#Clamp

Without it, navigator.vibrate(-1) becomes navigator.vibrate(4294967295).

It seems clamping it to 0 would be a more elegant way of handling this bad
input.

What do you think?

Regards,

Michael
Received on Tuesday, 22 October 2013 11:24:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:33:01 UTC