Skip to content

Instantly share code, notes, and snippets.

@jareiko
Created June 24, 2014 14:24
Show Gist options
  • Save jareiko/c5481e4f298ab44241e1 to your computer and use it in GitHub Desktop.
Save jareiko/c5481e4f298ab44241e1 to your computer and use it in GitHub Desktop.
var ReactiveValue = function(value) {
var dep = new Deps.Dependency();
var state = value;
this.get = function() {
dep.depend();
return state;
}
this.set = function(newValue) {
if (state === newValue) return;
state = newValue;
dep.changed();
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment