Re: [WebIDL] Simplify callbacks

On Nov 9, 2011, at 16:22 , Anne van Kesteren wrote:
> On Tue, 08 Nov 2011 13:23:13 -0700, David Flanagan <dflanagan@mozilla.com> wrote:
>> On 11/8/11 6:47 AM, Anne van Kesteren wrote:
>>> addEventListener(DOMString type, Callback(Event)? listener, optional boolean capture)
>> 
>> How about Callback means [Callback=FunctionOnly].  I.e.: you have to pass a function.  New interfaces could use this.
>> 
>> And EventCallback means [Callback] EventListener.  I.e. you can pass a function or any object with a handleEvent() method.  Legacy APIs (and new Event apis) can use that.
>> 
>> Some other thoughts:
>> 
>> - If these are going to be parameterized with the argument type, it seems like the WebIDL precedent is angle brackets as in sequence<DOMString>.
> 
> What do you mean here?

It's not 100% clear to me whether you wrote "Callback(Event)?" to mean "CallbackEvent or just Callback" or as a nullable Callback parameterised with Event. If the latter (which I think is the case), I believe that David is suggesting Callback<Event> for consistency with sequence<Foo>.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Wednesday, 9 November 2011 16:33:30 UTC