Debounce function with args underscore

后端 未结 4 1648
离开以前
离开以前 2021-01-31 06:51

I\'ve got a function which takes in some arguments. But usage of underscore debounce is :

var lazyLayout = _.debounce(calculateLayout, 300);

Bu

4条回答
  •  我在风中等你
    2021-01-31 07:26

    You should be able to just use an anonymous function as the first argument, then call whatever you like in it:

    _.debounce(function(){
        calculateLayout(20, 30);
    }, 300);
    

提交回复
热议问题