Options
All
  • Public
  • Public/Protected
  • All
Menu

Module vx-hooks/useThrottleFn

节流

Index

Interfaces

Functions

Functions

useThrottleFn

  • 节流

    example
    const cb = (d) => console.log(d)
    const { run, cancel } = useThrottleFn(cb, 1)
    
    run(1)
    // dely 1s
    
    run(2)
    run(3)
    
    => 1
    
    

    Type parameters

    • T: (...args: any) => any

      回调函数类型

    Parameters

    • fn: T

      回调

    • wait: number = 1

      延时间隔(s)

    Returns UseThrottleFnAPI

Generated using TypeDoc