Value Watcher class for JS
function ValueWatcher(value, callback, prequel) {
var that = this;
this.value = value;
this.onBeforeSet = prequel || function(){};
this.onAfterSet = callback || function(){};
this.setValue = function(newVal) {
that.onBeforeSet(that.value, newVal);
that.value = newVal;
that.onAfterSet(newVal);
}
this.getValue = function() {
return that.value;
}
}