- From: David Flanagan <dflanagan@mozilla.com>
- Date: Tue, 08 Nov 2011 13:59:14 -0800
- To: olli@pettay.fi
- CC: Olli Pettay <Olli.Pettay@helsinki.fi>, public-script-coord@w3.org
On 11/8/11 12:40 PM, Olli Pettay wrote: > On 11/08/2011 10:23 PM, David Flanagan wrote: >> On 11/8/11 6:47 AM, Anne van Kesteren wrote: >>> It seems that all callbacks use handleEvent() and we cannot change >>> that at this point I think. We should simplify callback syntax to a) >>> make IDL easier to read and b) ensure consistency throughout the >>> platform. >>> >>> 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. > We're trying to get rid of =FunctionOnly since there really isn't > any reason for that, and passing { the_name_of_the_callback: > function() {}} is actually useful in some cases. > Its useful in *some* cases, but the vast majority of the cases, developers just want to pass a function, not an object. I say make all new APIs take a function only, and let developers use ES5 Function.prototype.bind() when they want to specify a method. That's a lot easier than having to remember whether the appropriate property name is handleMutations, transactionStarted, or sample. David
Received on Tuesday, 8 November 2011 21:59:51 UTC