Created
June 24, 2014 14:24
-
-
Save jareiko/c5481e4f298ab44241e1 to your computer and use it in GitHub Desktop.
This file contains 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
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