JSFiddle - React, Tailwind, and code Playground
by lbstr
JavaScript
var objectManager = function(obj, setCallback){
this.obj = obj;
this.setCallback = setCallback;
};
objectManager.prototype.setProperty = function(prop, value){
this.obj[prop] = value;
this.setCallback(prop);
};
objectManager.prototype.getObj = function(){
return this.obj;
};
// USAGE:
var testMgr = new objectManager({}, function(prop){
document.write(name + ' has been set.');
});
testMgr.setProperty("hello", "world"); //should log "hello has been set.";