Skip to content

Instantly share code, notes, and snippets.

@petehunt
Created January 11, 2014 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petehunt/8378115 to your computer and use it in GitHub Desktop.
Save petehunt/8378115 to your computer and use it in GitHub Desktop.
function ObservableProperty(obj, key) {
this.obj = obj;
this.key = key;
}
ObservableProperty.prototype.get = function() {
return this.obj.get(this.key);
};
ObservableProperty.prototype.addObserver = function(target, method) {
this.obj.addObserver(this.key, target, method);
};
ObservableProperty.prototype.removeObserver = function(target, method) {
this.obj.removeObserver(this.key, target, method);
};
function getProperty(obj, key) {
return new ObservableProperty(obj, key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment