I would like to set a callback function to an Object that will be called whenever an undefined property in the Object is accessed or assigned to.
While this is not an exhaustive answer, keep in mind that assigning to undefined properties of an object is a key feature of the JavaScript language.
Also note that __noSuchMethod__
is a non-standard method, implemented by Mozilla's JavaScript engines. There is an open feature request for this to be implemented in Google Chrome's V8 engine, but as far as I know this is not supported in other browsers.
As of Feb 2014, It looks like this won't be supported any time soon.