Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

monitor changes made to object

var targetObj = {};
var targetProxy = new Proxy(targetObj, {
  set: function (target, key, value) {
      console.log(`${key} set to ${value}`);
      target[key] = value;
  }
});

targetProxy.hello_world = "test"; // console: 'hello_world set to test'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #monitor #object
ADD COMMENT
Topic
Name
9+7 =