title: Javascript, callback when object's attributes change?
body: <p>Functions in javascript are objects:</p>
  
  <pre><code>var x = function(){};
  x.y = 1;
  console.log(x.y); //Prints 1
  </code></pre>
  
  <p>Is there any way to call a function when y changes?</p>
  
  <p>My reason for doing this is that I'm trying to override jquery's "$" function so that I can benchmark performance. It works fine when the JS runs <code>$('mySelector')</code>. However, plugins that are created using <code>$.fn.myPlugin</code> will change the attributes in the object I overrided, rather than the original.</p>