- From: Jonas Sicking <jonas@sicking.cc>
- Date: Wed, 5 Sep 2012 03:09:06 -0700
- To: Anssi Kostiainen <anssi.kostiainen@nokia.com>
- Cc: "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>
Since this isn't a new object, but rather just additional properties on the window.navigator object, we should remove the interface completely and just do: partial interface Navigator { void vibrate (unsigned long time); void vibrate (unsigned long[] pattern); } That is effectively equivalent to having a "[NoInterfaceObject] Vibration" interface. The only difference that I can think of is if we start adding functions which takes arguments of type "Vibration", but I hope we have no such plans. Note that having a "real" interface without [NoInterfaceObject] is useless here since Vibration.prototype won't be in the prototype chain of window.navigator since the Navigator interface doesn't inherit the Vibration interface. / Jonas On Wed, Sep 5, 2012 at 1:47 AM, Anssi Kostiainen <anssi.kostiainen@nokia.com> wrote: > 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 10:15:35 UTC