Lodash Debounce not debouncing

前端 未结 2 1900
旧时难觅i
旧时难觅i 2020-12-16 11:11

I\'m trying to debounce a function using Lodash, and while it\'s invoking the function, it doesn\'t seem to debounce it at all. My issue doesn\'t seem to be the same mistake

2条回答
  •  Happy的楠姐
    2020-12-16 11:54

    Try this:

    s._makeSearchRequest = function() {
        console.log("making search request");
    }
    
    s.search = _.debounce( s._makeSearchRequest, 1000 );
    

    POC: http://jsfiddle.net/bvaughn/3saj6znk/

提交回复
热议问题