Created
December 14, 2017 16:39
-
-
Save andrewluetgers/b8ac8750a08f9ff9cc28c833a13a446d to your computer and use it in GitHub Desktop.
memoized debounce
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
// debounce function if arguments do not change | |
// https://github.com/lodash/lodash/issues/2403#issuecomment-290760787 | |
function activate(func, wait=0, options={}) { | |
var mem = _.memoize(function() { | |
return _.debounce(func, wait, options) | |
}, options.resolver); | |
return function(){mem.apply(this, arguments).apply(this, arguments)} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment