Skip to content

Instantly share code, notes, and snippets.

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