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

[vibra] Adding [NoInterfaceObject] to the Vibration interface

From: Anssi Kostiainen <anssi.kostiainen@nokia.com>
Date: Wed, 5 Sep 2012 11:47:33 +0300
Message-Id: <0DC34356-E8DD-4530-86CA-9A9B840762D5@nokia.com>
To: "public-device-apis@w3.org public-device-apis@w3.org" <public-device-apis@w3.org>, ext Justin Lebar <jlebar@mozilla.com>, 권기홍 Kwon <kihong.kwon@samsung.com>
Hi All, Justin, Kihong,

I noticed none of the known implementations [1] expose Vibration interface in the global context, so I updated the Vibration API Editor's Draft [2] to match the implementations. I.e. I added [NoInterfaceObject] to the Vibration interface as follows:

Navigator implements Vibration;

interface Vibration {
    void vibrate (unsigned long time);
    void vibrate (unsigned long[] pattern);

This change does not break feature detection as the usual pattern can still be used:

if (typeof navigator.vibrate === 'function') {
    console.log('Vibration API supported');

Let me know if there are concerns with this change.


[1] http://www.w3.org/2009/dap/wiki/ImplementationStatus#Vibration_API
[2] http://dev.w3.org/2009/dap/vibration/

[The reason we're using "[NoInterfaceObject] interface Foo" and "Bar implements Foo" instead of "partial interface Bar" is to allow other APIs to implement the Vibration interface instead of -- no pun intended -- respec'ing it. E.g. we've discussed use cases around Gamepad API re-using Vibration in the past in this group.]
Received on Wednesday, 5 September 2012 08:47:59 UTC

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