Utils.debounce(interval, handler)
Creates a function that will delay the calling of handler until after x seconds have elapsed since the last time it was invoked. Alias to ——debounce 译:创建一个函数,该函数将延迟调用处理程序的调用,直到X秒自上次调用它之后已经过去了。别名——debounce。
Arguments(参数)
interval— A number, representing seconds. 译:一个数字,代表秒。handler— A function. 译:一个函数。
handler = Utils.debounce 0.1, ->
print "hello"
for i in [1..100]
handler()
# Output: "hello" only once