Thanks. I did find this: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod
But that seems to be only useful for methods, not properties. I am running untrusted 3rd party code, so using || is out of the question. On Apr 5, 10:45 am, Peter van der Zee <[email protected]> wrote: > On Tue, Apr 5, 2011 at 10:38, mcot <[email protected]> wrote: > > I was wondering if you could have a function serve as the default > > function that gets called when a property is accessed. > > On Tue, Apr 5, 2011 at 4:40 PM, Gary Katsevman > <[email protected]>wrote: > > > I don't think that exists. Instead use the defaults operator `||' like so: > > Correct. > > Currently there are no magic "catch-all" mechanisms in the language. > Something called "proxies" are planned for the future. And some browsers > (most notably Firefox) allow you to create such catch-alls through the > __getter__ (I believe?) property, if you want to experiment. > > - peter -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
