Created
January 11, 2014 22:56
-
-
Save petehunt/8378115 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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