- From: Cameron McCormack <cam@mcc.id.au>
- Date: Thu, 18 Jun 2009 10:32:01 +1000
- To: Marcin Hanclik <Marcin.Hanclik@access-company.com>
- Cc: public-geolocation <public-geolocation@w3.org>
Marcin Hanclik: > > > then you’ll need to use [Callback] on the interface. > > > > > > http://dev.w3.org/2006/webapi/WebIDL/#Callback > It's a bit weird, but ok. The reasoning is that for most interfaces, you do not want to allow native objects to be considered as objects implementing interfaces. For example, you don’t want document.documentElement.appendChild({ nodeType: 1, nodeName: 'div', appendChild: function(n) { … }, removeChild: function(n) { … }, … }); to work. So an annotation is required to indicate which interfaces can be implemented by native objects. > > > If you specifically need to know whether a given ECMAScript > > > property exists on the native object, > This is our case. > > > > then that’s something currently > > > outside the realms of Web IDL. > propertyIsEnumerable and "for .. in" seem to handle the properties in ES, or? If you’re happy making requirements just for the ECMAScript language binding of the Geolocation spec, then that will work. Note that the Java language binding of the PositionOptions interface would be: public interface PositionOptions { void setEnableHighAccuracy(boolean b); boolean getEnableHighAccuracy(); void setTimeout(int i); int getTimeout(); void setMaximumAge(int i); int getMaximumAge(); } and all of the methods would need to be implemented, so omitting attributes doesn’t really make sense outside of ECMAScript. > My understanding is that the PositionOptions will never be > instantiated like var p = new PositionOptions(); > > We would use it only as you quoted: > >> navigator.getCurrentPosition(a, b, { enableHighAccuracy: true, > >> timeout: 5 }); > > Shall we then use the following? > [Callback=PropertyOnly] > interface PositionOptions { > attribute boolean enableHighAccuracy; > attribute long timeout; > attribute long maximumAge; > }; PropertyOnly is (or should be) only useful to control how interfaces with a single operation can be implemented by an ECMAScript object. It indicates that a Function object’s [[Call]] is not the implementation of the single operation on such interfaces, and that instead a property with the name of the operation is. At one point native objects couldn’t implement an interface if there were attributes on there; I probably need to update the wording for [Callback] to indicate that PropertyOnly/FunctionOnly really only apply for those single-operation interfaces. Thanks, Cameron -- Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 18 June 2009 00:32:46 UTC