- From: Robin Berjon <robin@w3.org>
- Date: Thu, 10 Jan 2013 16:19:00 +0100
- To: brandon.wallace@yahoo.com
- CC: "www-dom@w3.org" <www-dom@w3.org>
On 10/01/2013 14:38 , brandon.wallace@yahoo.com wrote: >> I meant that, if an object with methods were returned, the method >> should be named "off" as opposed to "cancel" or "stop" etc. Agreed >> that a function instead of an object is more elegant, however. > > I believe it has been mentioned that an object leaves the door open > for future enhancements. Returning only a function limits your > options for future enhancements. Actually, just because it's a function doesn't mean it can't be extended: var obj = function () { console.log("stop"); }; obj.start = function () { console.log("start"); }; obj(); obj.start(); Whether that's elegant is another question. -- Robin Berjon - http://berjon.com/ - @robinberjon
Received on Thursday, 10 January 2013 15:19:09 UTC