Created
September 12, 2017 05:47
-
-
Save davidgarsan/55c31d7547bf7e94fab04ff00db2c8b7 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 memoizeNewValue = function() { | |
var old = null; | |
return function(newVal){ | |
if(newVal === old) { | |
return false; | |
} else { | |
old = newVal; | |
return true; | |
} | |
} | |
}; | |
var isNewValue = memoizeNewValue(function(value) {}); | |
if(isNewValue()) { | |
// Do something. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment