SHARE
TWEET

Untitled

a guest Dec 17th, 2014 151 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. window.watch = function(oObj, sProp) {
  3.     sPrivateProp = "$_"+sProp+"_$"; // to minimize the name clash risk
  4.     oObj[sPrivateProp] = oObj[sProp];
  5.  
  6.     // overwrite with accessor
  7.     Object.defineProperty(oObj, sProp, {
  8.         get: function () {
  9.             return oObj[sPrivateProp];
  10.         },
  11.  
  12.         set: function (value) {
  13.             //console.log("setting " + sProp + " to " + value);
  14.             debugger; // sets breakpoint
  15.             oObj[sPrivateProp] = value;
  16.         }
  17.     });
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top