W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2011

Re: [WebIDL] Simplify callbacks

From: Robin Berjon <robin@berjon.com>
Date: Wed, 9 Nov 2011 17:32:57 +0100
Cc: public-script-coord@w3.org, "David Flanagan" <dflanagan@mozilla.com>
Message-Id: <F3049387-ECF9-4D28-AF17-84A8204CFA67@berjon.com>
To: Anne van Kesteren <annevk@opera.com>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC