[vibra] Adding [NoInterfaceObject] to the Vibration interface

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;

[NoInterfaceObject]
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.

-Anssi

[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