2 ms·
I don't think you really read what I wrote code-wise. I'm all for using accessors, that's why I wrote: var prop = model.prop() Note the parens there. I just
by autarch 15y ago
I don't think you really read what I wrote code-wise. I'm all for using accessors, that's why I wrote:
var prop = model.prop()
Note the parens there. I just like giving each accessor a unique method name as opposed to getting at all properties through a single get() method.
- tomdale 15y agoSure, but then you have to create a function for each property, even if it's a number or a string. Those bytes add up significantly in large applications. Additionally, specifying the property as a string allows you to implement "unknown property" handlers, which is another extremely powerful idiom.
- mbostock 15y agoThis might become more common when Proxy is supported more widely in JavaScript implementations. http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxie...