W3C home > Mailing lists > Public > public-device-apis@w3.org > January 2012

Re: Vibration API - There is no definition about invalid parameter.

From: Robin Berjon <robin@berjon.com>
Date: Wed, 11 Jan 2012 12:10:54 +0100
Cc: public-device-apis@w3.org
Message-Id: <26264C69-BAF9-47A1-8D84-0FC96B8E2FA8@berjon.com>
To: Kihong Kwon <vimff0@gmail.com>

On Dec 27, 2011, at 09:45 , Kihong Kwon wrote:
> There is no definition about invalid parameter in the spec.
> If I get a invalid parameter like string( navigator.vibrate("1000sec")
> or navigator.vibrate([1000 200 500 "msec"])),
> Which DOM Exception have to be set from the engine?(NOT_SUPPORTED_ERR??)

Normally, the invalid parameters that you describe should be handled by WebIDL (something which is complicated here by overloading). I'd give you the details except that WebIDL's overloading has recently been changed and I haven't yet had time to work through the fine print.

The relevant reading should be at:


I note that the IDL includes a mention of "raises". That's invalid IDL  we should fix that. Who's in charge of Vibration while Anssi's away?

> If the device gets vibrate message from WebAPP during it is vibrating
> already, how do I arrange these.
> There are three options, I think.
> 1. Stop the first vibration, and do the second.
> 2. Ignore the second
> 3. After finish the first vibration, do the second.

The rules are here:



     if the new pattern is 0 or [] (or anything that is automatically converted to these) then stop all vibration (step 3)
     if the new pattern is invalid for the implementation, then an exception is throw but the previous vibration continues (steps 5 and 7)
     otherwise, cancel the previous vibration and start the new one (step 8)

Robin Berjon - http://berjon.com/ - @robinberjon
Received on Wednesday, 11 January 2012 11:13:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:52 UTC