0

I know this has probably been asked everywhere but I'm not sure what it's called to look for it. Basically I have a javascript object:

var foo = Class.create();
foo.prototype = {
   ...
};

At this point, if somebody says myFooObject.bar = 7 I'd like it to hit some special method as bar is not defined, where I get the key (bar) and the value (7) and then I can do whatever with it.

Scott
  • 163
  • 2
  • 9
  • Possibly relevant http://stackoverflow.com/questions/20147081/javascript-catch-access-to-property-of-object – CupawnTae Feb 20 '15 at 23:06
  • 1
    You can only do this with [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) which are part of ECMA Script 6 specs and are not yet fully supported. – Robert Rossmann Feb 20 '15 at 23:08

0 Answers0