Utils.throttle(interval, handler)

Creates a function that will call the wrapped function at most once per x seconds. Alias to ——.throttle.
译:创建一个函数,该函数将调用最多一次每x秒的包函数。别名-throttle。

Arguments
  1. interval — A number, representing seconds.
  2. handler — A function.
handler = Utils.throttle 0.1, ->
    print "hello"

for i in [1..100]
    handler()

# Output: "hello" only once

results matching ""

    No results matching ""