Currently, I am attempting to use Lodash to debounce a function but it doesn't seem to be working properly. My issue appears to be different from what others have experienced on both Stack Overflow and Google when using the _.debounce method.
The implementation I have right now is quite simple (written in Angular with CoffeeScript):
s.search = -> _.debounce( s._makeSearchRequest, 1000 )()
s._makeSearchRequest = -> console.log("making search request")
In JavaScript, the code looks like this:
s.search = function() { _.debounce( s._makeSearchRequest, 1000 )() }
s._makeSearchRequest = function() { console.log("making search request") }
When I type into an input box and quickly enter random characters, "making search request" is printed multiple times per second in the console, indicating that the debouncing isn't happening as expected.
Any suggestions on what might be causing this issue?