Re: [Vibration] Feedback on the Vibration API

On Wed, Nov 7, 2012 at 5:26 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
> On Tue, Nov 6, 2012 at 11:35 AM, Anssi Kostiainen
> <anssi.kostiainen@nokia.com> wrote:
>> In early drafts we had 'vibrationstart' and 'vibrationend' events but we dropped them from v1 as we did not have compelling use cases for them. As always, we're happy to reconsider adding something similar in v2 if we unearth new use cases. I've added a note about this to our FutureWork wiki, so we don't forget:

I suggest you do

navigator.vibrate(1000);
setTimeout(function() { ... }, 1000);

and try it on a hardware device which supports the vibration API.  (I
believe Firefox on Android does.)  I suspect that the difference
between the setTimeout finishing and the vibration finishing will be
imperceptibly small.

In my view, this mostly obviates the need for "startVibrating" and
"stopVibrating" events.  Indeed, on Android, I'd implement those
events with a timer.  But doing it correctly involves informing the
page when the vibration is cancelled by something else on Android
calling the system vibrate function -- which is
difficult-to-impossible.

I probably would not implement startVibrating / stopVibrating events
in Firefox without an exceptionally compelling use-case, because it's
going to be difficult to get right on systems where we don't have
exclusive, low-level control of the vibrator.

-Justin

Received on Wednesday, 7 November 2012 17:24:34 UTC