W3C home > Mailing lists > Public > public-device-apis@w3.org > February 2014

Implied Pairs in the Vibration API

From: Iain Dawson <iain@musicfortheblind.co.uk>
Date: Sun, 16 Feb 2014 18:18:44 +0000
Message-ID: <CABgMhuGBG0qNygDnfDC2q96ESuBa_gXDCmT=9A3peGJavsx86g@mail.gmail.com>
To: public-device-apis@w3.org
I really don't like that the Vibration API assigns meaning to the numbers
in lists handed to it based solely on the oddness of their indices. This
means developers have to be incredibly careful to only ever extend their
lists two items at a time or risk subtle, difficult-to-track-down bugs.

One solution would be to create lists of lists of [activeTime, restTime],
but even this creates a situation where future extensions of the API would
have to run on top of a completely different interface.

>From my perspective, the *right* way to do this, while a little more
verbose, would be much more extensible and much more explicit; have the
thing take a list of vibration objects formatted something like {time:
[number], vibrate: [bool]}. This means you don't have to keep track of the
index of every item you append to your list and you open the door to future
parameters such as intensity or, who knows, motor selection in hypothetical
multi-vibration-motor devices.

It would, of course, be possible to support all three of these interfaces,
if so desired.
Received on Monday, 17 February 2014 09:30:14 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:02 UTC